1 Reply Latest reply on Jun 2, 2017 8:41 AM by mccloud

    Consuming a wsdl/web service in jbpm


      Hi everybody! I have been trying to get my hands on experience with jbpm and I have a necessity that I need to consume a webservice which takes multiple parameters and returns a double value. I have tried the following:

      1. Used a service task in KIE and tried.(Which was unsuccesful because service task only takes one parameter apparently)

      2. Used the WS Workitemhandler and tried to pass the parameters as a object, but got IllegalArgumentException instead.

      3. Created a custom data object and changed the type of parameter to the custom one, still couldnt consume the web service.


      Can you please help me in consuming it using jbpm business process?


      jbpm version: 6.3.0

        • 1. Re: Consuming a wsdl/web service in jbpm

          The jBPM WebServiceWorkItemHandler uses CXF DynamicClient under the covers to dynamically create a proxy and required classes from the given WSDL. The trick when using complex types/objects is to generate those classes from the WSDL yourself, for example using the "wsconsume.sh" tool provided with JBoss EAP/WildFly/BPM Suite. Something like this:

          > wsconsume.sh -kn http://www.webservicex.net/length.asmx?WSDL


          The -kn tells the tool to keep the generated sources and not to compile them. Next, you can add these classes to either the jBPM project containing the business process or you can add them to a JAR and have the your project containing the business-process depend on that JAR. The idea is then to instantiate the request object in your business process in a process variable, and map that process variable to the "Parameter" param of the WebServiceWorkItemHandler.


          Actually we have an example on how to do this in our Travel Agency demo: GitHub - jbossdemocentral/bpms-travel-agency-demo: A JBoss BPM Suite demo project around a travel agency booking workflo…


          In that demo, look at the way we call the FlightService, especially on how map the request and response in Data Input and Output Assignment of the WebServiceWorkItemHandler.