6 Replies Latest reply on May 13, 2014 11:31 AM by shephc01

    How to cast object in jBPM web service

    shephc01 Newbie

      Hello Team,

       

      I have been cracking my head on how to do this. I have a web service where I am sending an Integer (ideally I want to send an Object) to the service and expecting an Object in return.

      It appears as though the outbound SOAP message is working because in the console of my web service I can see the database query being returned. However, in JBoss BPMS I get the following error message

       

      Process Instances failed to start: [FlightProject.flightProcess:18 - WS:5] -- 
      org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- 
      com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane
      
      

       

      The Plane object on my BPMS process (demo.flight.bpms.Plane) is identical in terms of column count, column names, column position etc to the Plane object on my web service (com.jboss.soap.service.acmedemo.Plane)

       

      Any help will be appreciated. Unfortunately, all the examples I have seen so far either return a string or integer, but I want to return an object.

       

      The console message for bpms looks as follows:

      17:26:29,272 INFO  [stdout] (http-localhost.localdomain/127.0.0.1:8280-9) Initializing the service variables: 2
      17:26:29,384 INFO  [org.apache.cxf.endpoint.dynamic.DynamicClientFactory] (http-localhost.localdomain/127.0.0.1:8280-9) Created classes: com.jboss.soap.service.acmedemo.ListAvailablePlanes, com.jboss.soap.service.acmedemo.ListAvailablePlanesResponse, com.jboss.soap.service.acmedemo.ObjectFactory, com.jboss.soap.service.acmedemo.Plane, com.jboss.soap.service.acmedemo.PlaneBooking, com.jboss.soap.service.acmedemo.PlaneBookingId
      17:26:29,416 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8280-9) warning: [options] bootstrap class path not set in conjunction with -source 1.5
      17:26:29,580 ERROR [stderr] (http-localhost.localdomain/127.0.0.1:8280-9) 1 warning
      17:26:29,723 WARN  [org.drools.persistence.SingleSessionCommandService] (http-localhost.localdomain/127.0.0.1:8280-9) Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane
          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:135) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:155) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:337) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:296) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:61) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:57) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:155) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:337) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:296) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:66) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:43) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:155) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:226) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:362) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:194) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:176) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:168) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1575) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:366) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:121) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:40) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:533) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:377) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:232) [drools-core-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.console.ng.bd.backend.server.KieSessionEntryPointImpl.startProcess(KieSessionEntryPointImpl.java:79) [jbpm-console-ng-business-domain-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.console.ng.bd.backend.server.KieSessionEntryPointImpl$Proxy$_$$_WeldClientProxy.startProcess(KieSessionEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-business-domain-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.console.ng.ht.backend.server.FormModelerProcessStarterEntryPointImpl.startProcessFromRenderContext(FormModelerProcessStarterEntryPointImpl.java:44) [jbpm-console-ng-human-tasks-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.console.ng.ht.backend.server.FormModelerProcessStarterEntryPointImpl$Proxy$_$$_WeldClientProxy.startProcessFromRenderContext(FormModelerProcessStarterEntryPointImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-console-ng-human-tasks-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source) [:1.7.0_09-icedtea]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
          at org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:48) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:22) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.cdi.server.CDIExtensionPoints$3.callback(CDIExtensionPoints.java:499) [errai-weld-integration-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:284) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:97) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:114) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:140) [errai-bus-2.4.4.Final-redhat-3.jar:2.4.4.Final-redhat-3]
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.2.1.Final.jar:3.2.1.Final]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.2.1.Final.jar:3.2.1.Final]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70) [jbpm-designer-backend-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) [uberfire-security-server-0.3.2-redhat-6.jar:0.3.2-redhat-6]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:499) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:389) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]
      Caused by: org.jbpm.bpmn2.handler.WorkItemHandlerRuntimeException: org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane
          at org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:40) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.workitem.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:23) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler.executeWorkItem(WebServiceWorkItemHandler.java:175) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:56) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:124) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          ... 76 more
      Caused by: org.jbpm.workflow.instance.WorkflowRuntimeException: [FlightProject.flightProcess:18 - WS:5] -- com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:188) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerEvent(ExtendedNodeInstanceImpl.java:56) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:43) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:286) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:265) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:275) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:337) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:313) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:403) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:134) [drools-persistence-jpa-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          at org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler.executeWorkItem(WebServiceWorkItemHandler.java:116) [jbpm-workitems-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          ... 78 more
      Caused by: java.lang.ClassCastException: com.jboss.soap.service.acmedemo.Plane cannot be cast to demo.flight.bpms.Plane
          at demo.flight.bpms.flightproject.Process_demo$u46$flight$u46$bpms$u46$flightproject$u46$flightProcess1828573978Action3Invoker.execute(Process_demo$u46$flight$u46$bpms$u46$flightproject$u46$flightProcess1828573978Action3Invoker.java:12)
          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:182) [jbpm-flow-6.0.2-redhat-6.jar:6.0.2-redhat-6]
          ... 88 more
      
        • 1. Re: How to cast object in jBPM web service
          Mauricio Salatino Master

          Hi there,

          This looks more like a java question than a jbpm question. If you have two classes with the same name and the same columns they are not the same classes, so they cannot be casted. The question is why do you have two identical classes in two different packages? You should have a Model jar that is being shared between the server and the client.

          1 of 1 people found this helpful
          • 2. Re: How to cast object in jBPM web service
            shephc01 Newbie

            Hello Mauricio,

             

            Thanks for the response. I have managed to successfully return an object by using the default java.lang.Object definition instead of defining my variable as the Plane object. However, this leaves me with the dilemma of how to unmarshall the Object so that I can use its fields. Would I need some sort of helper (wrapper) class to do this? what sort of helper class? and where would I put it? In the end, I am struggling a bit to understand what jBPM is doing internally to handle returned Objects from a WSDL. I do have limited skills in java and even more limited skills in jBPM.

             

            Thanks in advance

            • 3. Re: How to cast object in jBPM web service
              Mauricio Salatino Master

              You need to learn how java works for that and how to build WebServices. Returning a java.lang.Object will not make any good, you need to return a type that is shared by both the server and the client, for that you create a separate jar that you add as dependency to both the server and the client.

              Regards

              • 4. Re: How to cast object in jBPM web service
                shephc01 Newbie

                In my original post, the two Plane objects were indeed of the same type shared by both the server and the client (albeit different package names). The class demo.flight.bpms.Plane is actually a dependency class I imported and made available to the BPMS project after I generated a wsdl client with wsimport. I renamed the package so that I would not confuse myself.

                • 5. Re: How to cast object in jBPM web service
                  Mauricio Salatino Master

                  If you change it to a different package they are not the same anymore.. there should be just one class with a single definition, which means just one file and those needs to be in an external jar

                  • 6. Re: How to cast object in jBPM web service
                    shephc01 Newbie

                    Okay, I have found out that the problem is that I needed to add my dependency classes (packaged as maven jar) into business-central.war/WEB-INF/lib instead of the artifacts repository.

                    Also, the dependency classes were generated by extracting the XSD from WSDL then creating the JAXB2 classes using the JAXB2 'xjc' tool using the binding file provided in this link: http://mswiderski.blogspot.in/2012/07/service-task-with-web-service.html with the command (xjc.sh -b cxf-jaxb-serializable-ext.xml test.xsd).  The resulting classes were put into a jar

                    Once the jar is loaded to business-central.war/WEB-INF/lib, within my BPM process, I can do "Result -> Object -> com.jboss.soap.service.acmedemo.Plane".


                    I can now return my object without any errors

                     

                    16:15:21,754 INFO  [stdout] (http-localhost.localdomain/127.0.0.1:8280-2) Input value is: [3]

                    16:15:21,771 INFO  [stdout] (http-localhost.localdomain/127.0.0.1:8280-2) returned test value = [com.jboss.soap.service.acmedemo.Plane@248344b]

                     

                    Since this works I want to try the input parameter as an Object instead of integer. Next step is to unmarshall this Object and retrieve particular fields but I hope this will be easier.