13 Replies Latest reply on Jan 19, 2015 10:11 PM by SANJAY GAUTAM

    jBPM unmarshallingexception (Web Service Task)

    Biswajit Sarkar Newbie

      I am new to jBPM. I am using jBPM6.

      I trying to invoke a web service from jBPM process using Web Service Task.

      My web service accept a object(Person) as input and return also a object(Person) as output.

      from my jBPM process I am able to invoke the process and pass the input object(Person). But while try to get the output object I am getting "unmarshalexception: unexpected element".

      following is my process ...

       

      <?xml version="1.0" encoding="UTF-8"?>

      <definitions id="Definition"

                   targetNamespace="http://www.jboss.org/drools"

                   typeLanguage="http://www.java.com/javaTypes"

                   expressionLanguage="http://www.mvel.org/2.0"

                   xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"

                   xmlns:g="http://www.jboss.org/drools/flow/gpd"

                   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"

                   xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"

                   xmlns:di="http://www.omg.org/spec/DD/20100524/DI"

                   xmlns:tns="http://www.jboss.org/drools">

                  

        <import importType="http://schemas.xmlsoap.org/wsdl/" location="http://localhost:9090/HelloComplexWeb/services/LookUpPerson?wsdl" namespace="http://test.com"/>


        <itemDefinition id="_sItem" structureRef="com.test.Person" />

        <itemDefinition id="_sItem2" structureRef="com.test.Person" />


        <itemDefinition id="_jbpm-unique-0_InMessageType" structureRef="com.test.Person" />

        <message id="_jbpm-unique-0_InMessage" itemRef="_jbpm-unique-0_InMessageType" />

        <interface id="_jbpm-unique-0_ServiceInterface" name="LookUpPersonService" implementationRef="LookUpPersonService" >

          <operation id="_jbpm-unique-0_ServiceOperation" name="personInfo" implementationRef="personInfo" >

            <inMessageRef>_jbpm-unique-0_InMessage</inMessageRef>

          </operation>

        </interface>


        <process processType="Private" isExecutable="true" id="com.sample.bpmn.helloComplexWeb" name="Hello Complex Web" >


          <!-- process variables -->

          <property id="person" itemSubjectRef="_sItem"/>

          <property id="personInfo" itemSubjectRef="_sItem2"/>


          <!-- nodes -->

          <startEvent id="_1"  isInterrupting="true"/>

          <endEvent id="_3" >

              <terminateEventDefinition />

          </endEvent>

          <serviceTask id="_jbpm-unique-0" name="WebServiceTask" operationRef="_jbpm-unique-0_ServiceOperation" implementation="##WebService" >

            <extensionElements>

              <tns:onEntry-script scriptFormat="http://www.java.com/java">

                <tns:script>System.out.println("In Service Task");</tns:script>

              </tns:onEntry-script>

              <tns:onExit-script scriptFormat="http://www.java.com/java">

                <tns:script>

                System.out.println("In Service Task exit");

                </tns:script>

              </tns:onExit-script>

            </extensionElements>

            <ioSpecification>

              <dataInput id="_jbpm-unique-0_param" name="Parameter" />

              <dataOutput id="_jbpm-unique-0_result" name="Result" />

              <inputSet>

                <dataInputRefs>_jbpm-unique-0_param</dataInputRefs>

              </inputSet>

              <outputSet>

                <dataOutputRefs>_jbpm-unique-0_result</dataOutputRefs>

              </outputSet>

            </ioSpecification>

            <dataInputAssociation>

              <sourceRef>person</sourceRef>

              <targetRef>_jbpm-unique-0_param</targetRef>

            </dataInputAssociation>

            <dataOutputAssociation>

              <sourceRef>_jbpm-unique-0_result</sourceRef>

              <targetRef>personInfo</targetRef>

            </dataOutputAssociation>

          </serviceTask>

          <scriptTask id="_jbpm-unique-7" name="Script" scriptFormat="http://www.java.com/java" >

            <script>

              person = (com.test.Person)kcontext.getVariable("Parameter");

              System.out.println("userId : "+person.getId());

             kcontext.setVariable("person", person);

            </script>

          </scriptTask>


          <!-- connections -->

          <sequenceFlow id="_jbpm-unique-0-_3" sourceRef="_jbpm-unique-0" targetRef="_3" />

          <sequenceFlow id="_jbpm-unique-7-_jbpm-unique-0" sourceRef="_jbpm-unique-7" targetRef="_jbpm-unique-0" />

          <sequenceFlow id="_1-_jbpm-unique-7" sourceRef="_1" targetRef="_jbpm-unique-7" />

        </process>


        <bpmndi:BPMNDiagram>

          <bpmndi:BPMNPlane bpmnElement="com.sample.bpmn.helloComplexWeb" >

            <bpmndi:BPMNShape bpmnElement="_1" >

              <dc:Bounds x="-8" y="97" width="48" height="48" />

            </bpmndi:BPMNShape>

            <bpmndi:BPMNShape bpmnElement="_3" >

              <dc:Bounds x="572" y="55" width="48" height="48" />

            </bpmndi:BPMNShape>

            <bpmndi:BPMNShape bpmnElement="_jbpm-unique-0" >

              <dc:Bounds x="220" y="105" width="100" height="48" />

            </bpmndi:BPMNShape>

            <bpmndi:BPMNShape bpmnElement="_jbpm-unique-7" >

              <dc:Bounds x="96" y="90" width="80" height="48" />

            </bpmndi:BPMNShape>

            <bpmndi:BPMNEdge bpmnElement="_jbpm-unique-0-_3" >

              <di:waypoint x="270" y="129" />

              <di:waypoint x="596" y="79" />

            </bpmndi:BPMNEdge>

            <bpmndi:BPMNEdge bpmnElement="_jbpm-unique-7-_jbpm-unique-0" >

              <di:waypoint x="136" y="114" />

              <di:waypoint x="270" y="129" />

            </bpmndi:BPMNEdge>

            <bpmndi:BPMNEdge bpmnElement="_1-_jbpm-unique-7" >

              <di:waypoint x="16" y="121" />

              <di:waypoint x="136" y="114" />

            </bpmndi:BPMNEdge>

          </bpmndi:BPMNPlane>

        </bpmndi:BPMNDiagram>

      </definitions>

       

      Please help me. I am not getting the output.

        • 1. Re: Getting Web Service(task) output object
          Biswajit Sarkar Newbie

          I am getting following exception ...

           

          Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://test.com", local:"personInfoReturn"). Expected elements are <{}personInfoReturn>

          • 2. Re: jBPM unmarshallingexception (Web Service Task)
            Rafael Chies Novice

            It seems that the namespace that your webservice server uses for the result Object is not the same as your "client" stub/object for this result object.

            I need to see your LookUpPersonService and Person classes to check this.

            • 3. Re: jBPM unmarshallingexception (Web Service Task)
              Biswajit Sarkar Newbie

              Thanks for reply Rafael

              Here is my Person.java class

               

              package com.test;

               

               

              import java.io.Serializable;

               

               

              public class Person implements Serializable {

               

                /**

                *

                */

                private static final long serialVersionUID = 1L;

                private String id;

                private String name;

                private String role;

               

                public String getId() {

                return id;

                }

                public void setId(String id) {

                this.id = id;

                }

                public String getName() {

                return name;

                }

                public void setName(String name) {

                this.name = name;

                }

                public String getRole() {

                return role;

                }

                public void setRole(String role) {

                this.role = role;

                }

               

               

              }

               

              LookUpPerson.java  Class

               

              package com.test;

               

               

              public class LookUpPerson {

               

                public Person personInfo(Person personInput){

                Person personOutput = new Person();

               

                if(personInput.getId().equals("b1515")){

                personOutput.setId(personInput.getId());

                personOutput.setName("james");

                personOutput.setRole("developer");

                }

                return personOutput;

                }

              }

               

              and the generated WSDL

               

              <?xml version="1.0" encoding="UTF-8"?>

              <wsdl:definitions targetNamespace="http://test.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://test.com" xmlns:intf="http://test.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

              <!--WSDL created by Apache Axis version: 1.4

              Built on Apr 22, 2006 (06:55:48 PDT)-->

              <wsdl:types>

                <schema elementFormDefault="qualified" targetNamespace="http://test.com" xmlns="http://www.w3.org/2001/XMLSchema">

                 <element name="personInfo">

                  <complexType>

                   <sequence>

                    <element name="person" type="impl:Person"/>

                   </sequence>

                  </complexType>

                 </element>

                 <complexType name="Person">

                  <sequence>

                   <element name="id" nillable="true" type="xsd:string"/>

                   <element name="name" nillable="true" type="xsd:string"/>

                   <element name="role" nillable="true" type="xsd:string"/>

                  </sequence>

                 </complexType>

                 <element name="personInfoResponse">

                  <complexType>

                   <sequence>

                    <element name="personInfoReturn" type="impl:Person"/>

                   </sequence>

                  </complexType>

                 </element>

                </schema>

              </wsdl:types>

               

               

                 <wsdl:message name="personInfoRequest">

               

               

                    <wsdl:part element="impl:personInfo" name="parameters">

               

               

                    </wsdl:part>

               

               

                 </wsdl:message>

               

               

                 <wsdl:message name="personInfoResponse">

               

               

                    <wsdl:part element="impl:personInfoResponse" name="parameters">

               

               

                    </wsdl:part>

               

               

                 </wsdl:message>

               

               

                 <wsdl:portType name="LookUpPerson">

               

               

                    <wsdl:operation name="personInfo">

               

               

                       <wsdl:input message="impl:personInfoRequest" name="personInfoRequest">

               

               

                     </wsdl:input>

               

               

                       <wsdl:output message="impl:personInfoResponse" name="personInfoResponse">

               

               

                     </wsdl:output>

               

               

                    </wsdl:operation>

               

               

                 </wsdl:portType>

               

               

                 <wsdl:binding name="LookUpPersonSoapBinding" type="impl:LookUpPerson">

               

               

                    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

               

               

                    <wsdl:operation name="personInfo">

               

               

                       <wsdlsoap:operation soapAction=""/>

               

               

                       <wsdl:input name="personInfoRequest">

               

               

                          <wsdlsoap:body use="literal"/>

               

               

                       </wsdl:input>

               

               

                       <wsdl:output name="personInfoResponse">

               

               

                          <wsdlsoap:body use="literal"/>

               

               

                       </wsdl:output>

               

               

                    </wsdl:operation>

               

               

                 </wsdl:binding>

               

               

                 <wsdl:service name="LookUpPersonService">

               

               

                    <wsdl:port binding="impl:LookUpPersonSoapBinding" name="LookUpPerson">

               

               

                       <wsdlsoap:address location="http://localhost:9090/HelloComplexWeb/services/LookUpPerson"/>

               

               

                    </wsdl:port>

               

               

                 </wsdl:service>

               

               

              </wsdl:definitions>

               

               

              • 4. Re: jBPM unmarshallingexception (Web Service Task)
                Rafael Chies Novice

                It's weird. I can't see where is configured in the bpmn2 the URL of the webservice. Do you really have used the Webservice task provided by jbpm6? If not, please use it! It's a workitem that comes out f the box, you just need to pass some parameters like de WSDL URL. What is the exactly version of jBPM you are using?!

                • 5. Re: jBPM unmarshallingexception (Web Service Task)
                  Biswajit Sarkar Newbie

                  Rafael Chies wrote:

                   

                  It's weird. I can't see where is configured in the bpmn2 the URL of the webservice. Do you really have used the Webservice task provided by jbpm6? If not, please use it! It's a workitem that comes out f the box, you just need to pass some parameters like de WSDL URL. What is the exactly version of jBPM you are using?!

                  Following is my bpm2 xml. I highlighted the web service configuration area in bpmn file.


                  <?xml version="1.0" encoding="UTF-8"?>

                  <definitions id="Definition"

                               targetNamespace="http://www.jboss.org/drools"

                               typeLanguage="http://www.java.com/javaTypes"

                               expressionLanguage="http://www.mvel.org/2.0"

                               xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                               xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"

                               xmlns:g="http://www.jboss.org/drools/flow/gpd"

                               xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"

                               xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"

                               xmlns:di="http://www.omg.org/spec/DD/20100524/DI"

                               xmlns:tns="http://www.jboss.org/drools">

                             

                    <import importType="http://schemas.xmlsoap.org/wsdl/" location="http://localhost:9090/HelloComplexWeb/services/LookUpPerson?wsdl" namespace="http://test.com"/>


                    <itemDefinition id="_sItem" structureRef="com.test.Person" />

                    <itemDefinition id="_sItem2" structureRef="com.test.Person" />


                    <itemDefinition id="_jbpm-unique-0_InMessageType" structureRef="com.test.Person" />

                    <message id="_jbpm-unique-0_InMessage" itemRef="_jbpm-unique-0_InMessageType" />

                    <interface id="_jbpm-unique-0_ServiceInterface" name="LookUpPersonService" implementationRef="LookUpPersonService" >

                      <operation id="_jbpm-unique-0_ServiceOperation" name="personInfo" implementationRef="personInfo" >

                        <inMessageRef>_jbpm-unique-0_InMessage</inMessageRef>

                      </operation>

                    </interface>


                    <process processType="Private" isExecutable="true" id="com.sample.bpmn.helloComplexWeb" name="Hello Complex Web" >


                      <!-- process variables -->

                      <property id="person" itemSubjectRef="_sItem"/>

                      <property id="personInfo" itemSubjectRef="_sItem2"/>


                      <!-- nodes -->

                      <startEvent id="_1"  isInterrupting="true"/>

                      <endEvent id="_3" >

                          <terminateEventDefinition />

                      </endEvent>

                     <serviceTask id="_jbpm-unique-0" name="WebServiceTask" operationRef="_jbpm-unique-0_ServiceOperation" implementation="##WebService" >

                        <extensionElements>

                          <tns:onEntry-script scriptFormat="http://www.java.com/java">

                            <tns:script>System.out.println("In Service Task");</tns:script>

                          </tns:onEntry-script>

                          <tns:onExit-script scriptFormat="http://www.java.com/java">

                            <tns:script>

                            System.out.println("In Service Task exit");

                            </tns:script>

                          </tns:onExit-script>

                        </extensionElements>

                        <ioSpecification>

                          <dataInput id="_jbpm-unique-0_param" name="Parameter" />

                          <dataOutput id="_jbpm-unique-0_result" name="Result" />

                          <inputSet>

                            <dataInputRefs>_jbpm-unique-0_param</dataInputRefs>

                          </inputSet>

                          <outputSet>

                            <dataOutputRefs>_jbpm-unique-0_result</dataOutputRefs>

                          </outputSet>

                        </ioSpecification>

                        <dataInputAssociation>

                          <sourceRef>person</sourceRef>

                          <targetRef>_jbpm-unique-0_param</targetRef>

                        </dataInputAssociation>

                        <dataOutputAssociation>

                          <sourceRef>_jbpm-unique-0_result</sourceRef>

                          <targetRef>personInfo</targetRef>

                        </dataOutputAssociation>

                      </serviceTask>

                      <scriptTask id="_jbpm-unique-7" name="Script" scriptFormat="http://www.java.com/java" >

                        <script>

                          person = (com.test.Person)kcontext.getVariable("Parameter");

                          System.out.println("userId : "+person.getId());

                         kcontext.setVariable("person", person);

                        </script>

                      </scriptTask>


                      <!-- connections -->

                      <sequenceFlow id="_jbpm-unique-0-_3" sourceRef="_jbpm-unique-0" targetRef="_3" />

                      <sequenceFlow id="_jbpm-unique-7-_jbpm-unique-0" sourceRef="_jbpm-unique-7" targetRef="_jbpm-unique-0" />

                      <sequenceFlow id="_1-_jbpm-unique-7" sourceRef="_1" targetRef="_jbpm-unique-7" />

                    </process>


                    <bpmndi:BPMNDiagram>

                      <bpmndi:BPMNPlane bpmnElement="com.sample.bpmn.helloComplexWeb" >

                        <bpmndi:BPMNShape bpmnElement="_1" >

                          <dc:Bounds x="-8" y="97" width="48" height="48" />

                        </bpmndi:BPMNShape>

                        <bpmndi:BPMNShape bpmnElement="_3" >

                          <dc:Bounds x="572" y="55" width="48" height="48" />

                        </bpmndi:BPMNShape>

                        <bpmndi:BPMNShape bpmnElement="_jbpm-unique-0" >

                          <dc:Bounds x="220" y="105" width="100" height="48" />

                        </bpmndi:BPMNShape>

                        <bpmndi:BPMNShape bpmnElement="_jbpm-unique-7" >

                          <dc:Bounds x="96" y="90" width="80" height="48" />

                        </bpmndi:BPMNShape>

                        <bpmndi:BPMNEdge bpmnElement="_jbpm-unique-0-_3" >

                          <di:waypoint x="270" y="129" />

                          <di:waypoint x="596" y="79" />

                        </bpmndi:BPMNEdge>

                        <bpmndi:BPMNEdge bpmnElement="_jbpm-unique-7-_jbpm-unique-0" >

                          <di:waypoint x="136" y="114" />

                          <di:waypoint x="270" y="129" />

                        </bpmndi:BPMNEdge>

                        <bpmndi:BPMNEdge bpmnElement="_1-_jbpm-unique-7" >

                          <di:waypoint x="16" y="121" />

                          <di:waypoint x="136" y="114" />

                        </bpmndi:BPMNEdge>

                      </bpmndi:BPMNPlane>

                    </bpmndi:BPMNDiagram>

                  </definitions>


                  I am using jbpm6.

                  • 6. Re: jBPM unmarshallingexception (Web Service Task)
                    Biswajit Sarkar Newbie

                    and here is my junit test class

                     

                    package com.sample;


                    import java.util.HashMap;

                    import java.util.Map;


                    import org.drools.runtime.process.WorkItem;

                    import org.drools.runtime.process.WorkItemHandler;

                    import org.drools.runtime.process.WorkItemManager;

                    import org.jbpm.process.workitem.bpmn2.ServiceTaskHandler;

                    import org.jbpm.test.JbpmJUnitBaseTestCase;

                    import org.junit.Test;

                    import org.kie.api.runtime.KieSession;

                    import org.kie.api.runtime.manager.RuntimeEngine;

                    import org.kie.api.runtime.manager.RuntimeManager;

                    import org.kie.api.runtime.process.ProcessInstance;


                    import com.test.Person;


                    public class TestProcess2 extends JbpmJUnitBaseTestCase{

                      @Test

                      public void testProcess() throws InterruptedException {

                      RuntimeManager manager = createRuntimeManager("complex.bpmn");

                      RuntimeEngine engine = getRuntimeEngine(null);

                      //TestWorkItemHandler htHandler = new TestWorkItemHandler();

                      KieSession ksession = engine.getKieSession();

                      ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new     ServiceTaskHandler(ksession));

                      Person newPerson = new Person();

                      newPerson.setId("b1515");

                      Map<String, Object> params = new HashMap<String, Object>();

                      

                            // change this parameter to sync to see elements executes sequentially

                            params.put("Parameter", newPerson);

                      ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.helloComplexWeb", params);

                      // check whether the process instance has completed successfully

                      assertProcessInstanceCompleted(processInstance.getId(), ksession);

                      assertNodeTriggered(processInstance.getId(), "WebServiceTask");

                      manager.disposeRuntimeEngine(engine);

                      manager.close();

                      }


                      static class TestWorkItemHandler implements WorkItemHandler {


                      private static TestWorkItemHandler INSTANCE = new TestWorkItemHandler();

                     

                      private WorkItem workItem;

                      private WorkItem aborted;

                      public static TestWorkItemHandler getInstance() {

                      return INSTANCE;

                      }

                     

                      public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

                      this.workItem = workItem;

                      }


                      public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {

                      this.aborted = workItem;

                      }

                     

                      public WorkItem getWorkItem() {

                      WorkItem result = workItem;

                      workItem = null;

                      return result;

                      }


                      public WorkItem getAbortedWorkItem() {

                      WorkItem result = aborted;

                      aborted = null;

                      return result;

                      }


                      }


                    }


                    • 7. Re: jBPM unmarshallingexception (Web Service Task)
                      Rafael Chies Novice

                      HI Biswajit,

                       

                      I think the problem is happening because there are some concepts of workitemhandler that you are missing in this example.

                      The tasks with a custom behavior, like a REST/SOA call, has to be based in a custom work item handler. In jBPM 6 there is already an implementation for that: org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler. If you were using the business-central to build the process definition, you will see a task type that is the Webservice call in the palette. However, as you are using a embedded engine, and probably drawing the flow in your IDE (Eclipse or JBDS), you need to do the clue to use this WebServiceWorkItemHandler in your flow.

                       

                      As soon as I get a free time here, I'll build a basic example for that. Until there, if you want, you can try by yourself using some steps exposed in the documentation [1].

                       

                      [1] https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_BPM_Suite/6.0/html/User_Guide/sect-Domain-specific_Tasks.htm…

                      1 of 1 people found this helpful
                      • 8. Re: jBPM unmarshallingexception (Web Service Task)
                        Biswajit Sarkar Newbie

                        thanks rafachies for your reply...

                         

                        As I am using embedded engine I try following code to register workitemhandler

                         

                          RuntimeManager manager = createRuntimeManager("complex.bpmn");

                          RuntimeEngine engine = getRuntimeEngine(null);

                          KieSession ksession = engine.getKieSession();

                          ksession.getWorkItemManager().registerWorkItemHandler("Service Task", new WebServiceWorkItemHandler(ksession));

                         

                        But still I am getting same exception.

                        jan 08, 2015 1:06:22 PM org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames

                        INFO: Created classes: com.test.ObjectFactory, com.test.Person, com.test.PersonInfo, com.test.PersonInfoResponse

                        jan 08, 2015 1:06:26 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging

                        WARNING: Interceptor for {http://test.com}LookUpPersonService#{http://test.com}personInfo has thrown exception, unwinding now

                        org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"http://test.com", local:"personInfoReturn"). Expected elements are <{}personInfoReturn>

                          at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)

                          at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)

                          at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:160)

                          at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:107)

                          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)

                          at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:845)

                          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1624)

                          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1513)

                          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1318)

                          at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)

                          at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632)

                          at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)

                          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)

                          at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)

                          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)

                          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)

                          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)

                          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355)

                          at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:341)

                        at org.jbpm.process.workitem.bpmn2.ServiceTaskHandler.executeWorkItem(WebServiceWorkItemHandler.java:101)

                         

                        Please share a basic example to register the workitemhandler for web service task.

                         

                        thanks in advance

                        • 9. Re: jBPM unmarshallingexception (Web Service Task)
                          Rafael Chies Novice

                          I believe the problem is that maybe you have used some examples that is from jbpm 5, and maybe mixed some strategies. I've just created a simple example using jbpm 6 that is on my github [1].

                           

                          My test was based in a JBoss Developer Studio  7.1, but sure that this also works in Eclipse with JBoss Tools.

                          The key point here is that you are not going to use any out of the box tasks provided by jBPM, you are going to customize your own Custom Task (your WSTask). This is done in my example through the Webservice.wid file, in syr/main/resources/META-INF. The BPMN2 Modeler of JBDS load this .wid file, and so provides this custom Task in the modeler palette, below  "Custom Taks".

                           

                          Now, you have just to register the work item handler responsible for handling this custom WSTask. As I've already mentioned, there is an implementation out of the box, the WebServiceWorkItemHandler. By default, this handler expects some inputs like URL, Service, namespace, etc. This is the reason in my .wid file I  declared those parameters.

                           

                          Just as an example, I've used a test webservice provided online, but sure you can use your own WSDL if you want.

                           

                           

                          [1] - examples/jbpmwstask at master · rafachies/examples · GitHub

                          • 10. Re: jBPM unmarshallingexception (Web Service Task)
                            Biswajit Sarkar Newbie

                            Thanks a lot Rafael. You made my day . thanks a lot

                            • 11. Re: jBPM unmarshallingexception (Web Service Task)
                              SANJAY GAUTAM Expert

                              Hi Rafael,

                              Please suggest me what I need to do if the Parameter is Pojo , ? I know I can update the xxx.wid  to ObjectDataType instead of StringDataType  but when I go and try to assign and save the process it give ms invalid mapping

                              any suggestion to resolve that issue ?

                               

                              I notice that you passed two numbers i.e. array of integer and mapped it to the Parameter and it took it successfully why ?

                               

                              If I map Data Input Mapping  =>  Parameter  => OasisNotificationCtlDto

                               

                              paramter4.png

                              Please suggest me what needs to be done. service is called successfully but since the pojo is not having any values webservice throws null pointer exception.

                               

                               

                              Thanks

                              Sanjay Gautam

                              • 12. Re: jBPM unmarshallingexception (Web Service Task)
                                Rafael Chies Novice

                                Hi Sanjay Gautam,

                                 

                                Sorry the delay, but I have been busy at work.

                                It should be just fine, creating the POJO class that represents the complex type in WSDL, and so use it in the Parameter in the WSTask. The POJO can be created through any wsdl2java tool.

                                But I have to say that I tested this here, with a example of service that expect a POJO as the request [1], and some issues ere raised. I'm gonna investigate it.

                                 

                                [1] http://downloads.smartbear.com/samples/testcomplete10/webservices/Service.asmx?WSDL

                                • 13. Re: jBPM unmarshallingexception (Web Service Task)
                                  SANJAY GAUTAM Expert

                                  Rafael Chies wrote:

                                   

                                  Hi Sanjay Gautam,

                                   

                                  Sorry the delay, but I have been busy at work.

                                  It should be just fine, creating the POJO class that represents the complex type in WSDL, and so use it in the Parameter in the WSTask. The POJO can be created through any wsdl2java tool.

                                  But I have to say that I tested this here, with a example of service that expect a POJO as the request [1], and some issues ere raised. I'm gonna investigate it.

                                   

                                  [1] http://downloads.smartbear.com/samples/testcomplete10/webservices/Service.asmx?WSDL

                                  Thanks for replying @Rafael Chies  I can totally understand the busy ness. I believe the kie is correctly validating it though but the examples and mapping/assignment dialog kind of confused me, I tried several option and I was able to find out how to make it work though.  I kept the process variable in the left (From ) and Parameter(Right) actually in the async examples it was reversed and hence I thought as that is the provided by Jboss might be the consistent way of assigning and mapping these parameters. and hence I didn't wanted to try combinations. but later on I tried and it worked at least saved the parameter mapping. Secondly my assumption was that CXF apis which are based on dynamic client I thought I will pass the DTO inside the WebService Handler and it will work directly. but that was a wrong assumption some how. to me to conlude looks like that for each webservice call I have to create mapping webservice call in order to make things work. we cannot use the WS service provided out of the box for all our requirements even though it uses the Dynamic client which was my ultimate goal.  but i had some dead lines too , i will experiment with those APIs little latter though but so far i was able to resolve the issue. but keep me posted with the details.

                                  Other Thread with Details

                                  To me looks like out of the box webservice work item handler is just good for the array ob string or integers as method arguments for the webmethod if I have pojo it will not work and I might have to resort to other ways of creating the clients.

                                   

                                  Thanks

                                  Sanjay Gautam