cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Actitivi 5.9 and Web Service calls

erny18031
Champ in-the-making
Champ in-the-making
Hi.

Hi would like to use the standard BPMN way to call web services (no specific clients).

My BPMN is something like this:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:activiti="http://activiti.org/bpmn"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
             xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
             typeLanguage="http://www.w3.org/2001/XMLSchema"
             expressionLanguage="http://www.w3.org/1999/XPath"
             targetNamespace="http://www.activiti.org/test"
             xmlns:tns="http://www.activiti.org/test"
             xmlns:weather="http://www.webserviceX.NET">
  <import importType="http://schemas.xmlsoap.org/wsdl/"
        location="http://www.webservicex.net/globalweather.asmx?WSDL"
        namespace="http://www.webserviceX.NET" />

  <process id="ProcesoEjemplo" name="ProcesoEjemplo">
    <ioSpecification>
        <dataInput id="dataInputOfProcess" itemSubjectRef="tns:requestItem" />
        <dataOutput id="dataOutputOfProcess" itemSubjectRef="tns:responseItem" />
        <inputSet>
           <dataInputRefs>dataInputOfProcess</dataInputRefs>
        </inputSet>
        <outputSet>
           <dataOutputRefs>dataOutputOfProcess</dataOutputRefs>
        </outputSet>
     </ioSpecification>
    <startEvent id="startevent1" name="Start"></startEvent>

    <serviceTask id="wscall" name="LLamar WS" implementation="##WebService" operationRef="tns:operationId">
        <ioSpecification>
              <dataInput itemSubjectRef="tns:requestItem" id="dataInputOfServiceTask" />
              <dataOutput itemSubjectRef="tns:responseItem" id="dataOutputOfServiceTask" />
              <inputSet>
                      <dataInputRefs>dataInputOfServiceTask</dataInputRefs>
              </inputSet>
              <outputSet>
                      <dataOutputRefs>dataOutputOfServiceTask</dataOutputRefs>
              </outputSet>
        </ioSpecification>
        <dataInputAssociation>
            <sourceRef>dataInputOfProcess</sourceRef>
              <targetRef>dataInputOfServiceTask</targetRef>
            <assignment>
                  <from>${dataInputOfProcess.pais}</from>
                  <to>${dataInputOfServiceTask.CountryName}</to>
                </assignment>
        </dataInputAssociation>
        <dataOutputAssociation>
            <sourceRef>dataOutputOfServiceTask</sourceRef>
              <targetRef>dataOutputOfProcess</targetRef>
            <assignment>
                  <from>${dataOutputOfServiceTask}</from>
                  <to>${dataInputOfProcess.ciudades}</to>
                </assignment>
          </dataOutputAssociation>
    </serviceTask>

  </process>
  <interface name="Interface" implementationRef="weather:GlobalWeatherSoap">
      <!– Operation: implementationRef = QName of WSDL Operation –>
      <operation id="operationId" name="Operacion WS" implementationRef="weather:GetCitiesByCountry">
         <inMessageRef>tns:requestMessage</inMessageRef>
         <outMessageRef>tns:responseMessage</outMessageRef>
      </operation>
  </interface>
<message id="requestMessage" itemRef="tns:requestItem" />
<message id="responseMessage" itemRef="tns:responseItem" />
<itemDefinition id="requestItem" structureRef="weather:GetCitiesByCountry" />
<itemDefinition id="responseItem" structureRef="weather:GetCitiesByCountryResponse" />

</definitions>

Whenever I run the test (whithout activiti-cxf) I get :

org.activiti.engine.ActivitiException: Could not find importer for type http://schemas.xmlsoap.org/wsdl/ | diagrams/ProcesoEjemplo.bpmn20.xml | line 16 | column 50
Could not import item of type http://schemas.xmlsoap.org/wsdl/ | diagrams/ProcesoEjemplo.bpmn20.xml | line 16 | column 50

When I include activiti-cxf, I get the following error:

java.lang.ClassCastException: com.sun.codemodel.JCodeModel$JReferencedClass cannot be cast to com.sun.codemodel.JDefinedClass
   at org.activiti.engine.impl.webservice.CxfWSDLImporter.importStructure(CxfWSDLImporter.java:152)
   at org.activiti.engine.impl.webservice.CxfWSDLImporter.importTypes(CxfWSDLImporter.java:146)
   at org.activiti.engine.impl.webservice.CxfWSDLImporter.importFrom(CxfWSDLImporter.java:106)
   at org.activiti.engine.impl.webservice.CxfWSDLImporter.importFrom(CxfWSDLImporter.java:69)
   at org.activiti.engine.impl.bpmn.parser.BpmnParse.parseImports(BpmnParse.java:310)


What do I wrong?

Thanx.
Erny
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Hi,

Can you create a unit test that reproduces this error?

Best regards,

mss21
Champ in-the-making
Champ in-the-making
Hi,

I am trying to test a public webservice by invoking it from webservice task. I have modified the .bpmn xml with the entries.
could anyone share a example on how to invoke a public webservice and how to test it,

Also can we create 2 service task and link them to pass the output of 1 service as input to another.

jurtiaga
Champ in-the-making
Champ in-the-making
I´m using the Activiti 5.10 and I have the same problem.
When I´m goint to deploy the process I get the error: "could not find importer for type http //schemas.xmlsoap.org/wsdl/"

I´ve attached the unit Test for this process, this page does not allow me to upload the files, so here we go…


#######################  UNIT TEST #############################
package org.activiti.designer.test;

import static org.junit.Assert.*;

import java.util.HashMap;
import java.util.Map;
import java.io.FileInputStream;

import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.test.ActivitiRule;
import org.junit.Rule;
import org.junit.Test;

public class ProcessTestProcess1 {

private String filename = "D:/ws.bpmn";

@Rule
public ActivitiRule activitiRule = new ActivitiRule();

@Test
public void startProcess() throws Exception {
  RepositoryService repositoryService = activitiRule.getRepositoryService();
  repositoryService.createDeployment().addInputStream("process1.bpmn20.xml",
    new FileInputStream(filename)).deploy();
  RuntimeService runtimeService = activitiRule.getRuntimeService();
  Map<String, Object> variableMap = new HashMap<String, Object>();
  variableMap.put("name", "Activiti");
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process1", variableMap);
  assertNotNull(processInstance.getId());
  System.out.println("id " + processInstance.getId() + " "
    + processInstance.getProcessDefinitionId());
}
}
#############################################################################################

frederikherema1
Star Contributor
Star Contributor
Try adding activiti-cxf as a dependency, the webservice-parsing is handled by this class: org.activiti.engine.impl.webservice.CxfWSDLImporter