Skip to main content
Jump to: navigation, search

Stardust/Knowledge Base/Web Service API/Starting Processes Interface And Fetching Results over REST

Requirements

  • Consume IPP Process Interface over REST to:
  • Start the process [pass the IN parameter (if any)], and
  • Receive the OUT parameter after process execution completes itself

How to Do

  • We will be defining a process as an Interface.
  • We will deploy it and then work on consuming it using SOAP UI over both SOAP and REST.
  • There could be 3 scenarios:
  • If the process is straight through (without any manual activity, AND Split and there are no interruptions – exceptions are handled – one will get the return value from the process execution, if the process was started with synchronous flag as ‘true’.
  • If the process is straight through (without any manual activity, AND Split and there are no interruptions – exceptions are handled – one will get the process instance OID of the executed process, if the process was started with synchronous flag as ‘false’.
  • If the process is not straight through (with any manual activity, AND Split and there are interruptions – exceptions are not handled – one will get the process instance OID of the executed process. And we need to issue another request to fetch the return value from the process.
  • Lets look at the URLs for all the above 3 scenarios:
  • Straight through process with synchronous flag as ‘true’:
  • Straight through process with synchronous flag as ‘false’:
  • Not straight through process. Any of the above mentioned URLs to start the process instance and then:


  • The Process Definition
  • 2 activity, straight through process, first activity adds word “Changed” to the Incoming data and stores into Outgoing data using Message Transformation Activity.
  • Next is a route activity.
  • INCOMING Data is mapped to the FormalParameter1 which is coming from client
  • OUTGOING Data is mapped to FormalParameter2, which is to be sent to the client

Picture1.1.jpg

Model can be found here File:Test73Model.zip

  • Defining the Process:
  • Double Click on the Process to open its Property
  • Click on Process Interface and make selections as shown in the image:
  • Add FormalParameter1 (IN) and 2(OUT) as shown in image
  • Click on “Generate WSDL” button to generate WSDL of the Process Interface.
  • Save and Deploy the model

Picture2.jpg Picture3.jpg Picture4.jpg

  • Setting up Client SOAPUI
  • Create a new SOAP Project and give it a name. The WSDL to give there is:

Picture5.jpg

  • Once you are done with this step you get the SOAP project created like this:

Picture6.jpg

  • Double Click on Request1 of startProcessNewProcess and create the request like shown in the image and run.
  • The Response pane shows the return data from process Instance.

Picture7.jpg

  • Now Lets start the process over REST
  • Right click on Project and select Add WADL, provide WADL location as:

Picture8.png

  • Once done, you should get REST request added to the project like shown below

Picture9.jpg

  • Create the Request1 of POST like shown here (synchronous is true):
::<tes:Args xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tes="http://eclipse.org/stardust/models/generated/Test73Model">
::      <tes:FormalParameter1>Vikash</tes:FormalParameter1>
::</tes:Args>

Picture10.jpg

  • Create the Request1 of POST like shown here (synchronous is false):
  • For the same request the response has changed, this time you receive the piOID and not the result data.
<data contentType="text/plain" contentLength="117">
<![CDATA[http://localhost:9090/TestProject73/services/rest/engine/processes/NewProcess?piOID=14&stardust-bpm-model=Test73Model]]>
</data>

Picture11.jpg

  • Now Lets change the process definition to have a manual activity so that it becomes non straight through. And deploy the model.

Picture12.jpg

  • Now Lets run the request to start the process again with both synchronous as true and false. With true:
  • Result is:
<data contentType="text/plain" contentLength="117">
<![CDATA[http://localhost:9090/TestProject73/services/rest/engine/processes/NewProcess?piOID=15&stardust-bpm-model=Test73Model]]>
</data>


  • With false, Result is
<data contentType="text/plain" contentLength="117">
<![CDATA[http://localhost:9090/TestProject73/services/rest/engine/processes/NewProcess?piOID=16&stardust-bpm-model=Test73Model]]>
</data>

We are getting the same result (only piOID and not result after process completion).

Now lets complete the process and use the other URL to get the result.

  • piOID 15 is completed by completing activity Manual Activity 1 and now we will use another request – GET of /process/{processId} (as shown below to get the result).

Picture13.jpg

Back to the top