AnsweredAssumed Answered

Error invoking a Web service in bpmn using activiti

Question asked by sopheachhun on May 7, 2014
Latest reply on May 7, 2014 by sopheachhun
Dear Everyone,

Please help me.

I want to invoke web service in bpmn process.
I try with javadelegate, it works. However, using this java delegate, we have to restart the server every time a new business process is implemented.

So, I try with invoking wsdl directly into bpmn process.
I follow the tutorial in activiti book but I get this error:

errors while parsing:[validation set:'activiti-executable-process'|problem:'activiti-servertask-missing-implementation']': one of the attributes 'class', 'delegateExpression','type','operation' or 'expression' is mandatory on service task. [extra info: processDefinitionId=myProcess|processDefinitionName=my process||id=iservicetask1||activitiname=addition service|]

Here my wsdl content:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://activiti.customer" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://activiti.customer">
    <wsdl:documentation>Customer</wsdl:documentation>
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://activiti.customer">
            <xs:element name="sum">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="number" type="xs:int"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="sumResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" type="xs:int"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="sumRequest">
        <wsdl:part name="parameters" element="ns:sum"/>
    </wsdl:message>
    <wsdl:message name="sumResponse">
        <wsdl:part name="parameters" element="ns:sumResponse"/>
    </wsdl:message>
    <wsdl:portType name="CustomerPortType">
        <wsdl:operation name="sum">
            <wsdl:input message="ns:sumRequest" wsaw:Action="urn:sum"/>
            <wsdl:output message="ns:sumResponse" wsaw:Action="urn:sumResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CustomerSoap11Binding" type="ns:CustomerPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="sum">
            <soap:operation soapAction="urn:sum" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="CustomerSoap12Binding" type="ns:CustomerPortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="sum">
            <soap12:operation soapAction="urn:sum" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="CustomerHttpBinding" type="ns:CustomerPortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="sum">
            <http:operation location="sum"/>
            <wsdl:input>
                <mime:content type="text/xml" part="parameters"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="parameters"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Customer">
        <wsdl:port name="CustomerHttpSoap11Endpoint" binding="ns:CustomerSoap11Binding">
            <soap:address location="http://159.84.110.102:9763/services/Customer.CustomerHttpSoap11Endpoint/'/>
        </wsdl:port>
        <wsdl:port name="CustomerHttpsSoap11Endpoint" binding="ns:CustomerSoap11Binding">
            <soap:address location="https://159.84.110.102:9443/services/Customer.CustomerHttpsSoap11Endpoint/'/>
        </wsdl:port>
        <wsdl:port name="CustomerHttpSoap12Endpoint" binding="ns:CustomerSoap12Binding">
            <soap12:address location="http://159.84.110.102:9763/services/Customer.CustomerHttpSoap12Endpoint/'/>
        </wsdl:port>
        <wsdl:port name="CustomerHttpsSoap12Endpoint" binding="ns:CustomerSoap12Binding">
            <soap12:address location="https://159.84.110.102:9443/services/Customer.CustomerHttpsSoap12Endpoint/'/>
        </wsdl:port>
        <wsdl:port name="CustomerHttpEndpoint" binding="ns:CustomerHttpBinding">
            <http:address location="http://159.84.110.102:9763/services/Customer.CustomerHttpEndpoint/'/>
        </wsdl:port>
        <wsdl:port name="CustomerHttpsEndpoint" binding="ns:CustomerHttpBinding">
            <http:address location="https://159.84.110.102:9443/services/Customer.CustomerHttpsEndpoint/'/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>



here my bpmn file:
<?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.bpmnwithactiviti.org"> <!– add this one –>
   
   <!–1. import the wsdl file–>
   <import importType="http://schemas.xmlsoap.org/wsdl/"
        location="http://159.84.110.102:9763/services/Customer?wsdl"
        namespace="http://activiti.customer" />
   
    <!– 2. define the request message –>
    <message id="sumRequestMessage"
       itemRef="tns:sumRequestItem"/>
    <message id="sumResponseMessage"
       itemRef="tns:sumResponseItem"/>

    <!– 3. define reference of wsdl input message –> 
   <itemDefinition id="sumRequestItem"
      structureRef="ns:sumRequest"/> <!– wsdl:portype:operation:input:message –>
   <itemDefinition id="sumResponseItem"
      structureRef="ns:sumResponse"/> <!– wsdl:portype:operation:output:message –>
      
    <!– 4. references wsdl port type –>
   
    <interface name="addition operatoin" implementationRef="CustomerPortType"> <!– port type's name –>
       <!– 5. reference wsdl operation –>
        <operation id="sumOperation"
           name="Calculate addition"
          implementationRef="sum"> <!– operation's name –>
          <inMessageRef>tns:sumRequestMessage</inMessageRef> <!– message's id –>
            <outMessageRef>tns:sumRequestMessage</outMessageRef>
       </operation>
   </interface>
    <!– 6. input element as defined in wsdl –>
     <itemDefinition id="UserNumber" structureRef="int" />
     <itemDefinition id="sum" structureRef="int" /> <!– input:ele:name –>
     <itemDefinition id="response" structureRef="int" />
     <itemDefinition id="sumResponse" structureRef="int" /> <!– output:ele:name –>
    
  <process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1"
       name="addition service"
       implementation="##WebService"
       operationRef="tns:sumOperation">
       <ioSpecification>
         <dataInput
            itemSubjectRef="tns:sumRequestItem"
            id="dataInput" />
         <dataOutput
            itemSubjectRef="tns:sumResponseItem"
            id="dataOutput" />
         <inputSet>
            <dataInputRefs>dataInput</dataInputRefs>
         </inputSet>
         <outputSet>
            <dataOutputRefs>dataOutput</dataOutputRefs>
         </outputSet>
      </ioSpecification>
      <dataInputAssociation>
         <sourceRef>UserNumber</sourceRef>
         <targetRef>sum</targetRef>
      </dataInputAssociation>
      <dataOutputAssociation>
         <sourceRef>response</sourceRef>
         <targetRef>sumResponse</targetRef>
      </dataOutputAssociation>
    </serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>
 
  <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
    <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="120.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="250.0" y="170.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="460.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="155.0" y="197.0"></omgdi:waypoint>
        <omgdi:waypoint x="250.0" y="197.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="355.0" y="197.0"></omgdi:waypoint>
        <omgdi:waypoint x="460.0" y="197.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

waiting for your reply, thanks
sophea

Outcomes