Friday, January 29, 2016

Invoke a Web service with Eclipse BPEL designer and Apache ODE

The steps to create a BPEL process with Web Service invocation is as follows.

Create the BPEL Project
  • Select File->New->Project->BPEL 2.0-> BPEL Project

  •  Give a name to the project and Select Apache ODE 1.x as the target Runtime. (Details on how to configure run time is given in post).

  • Right Click on bpelContent Folder in the project view and New->Other->BPEL 2.0 -> BPEL Process File. Click Next.
    • Fill in BPEL Process Name(WSTest) and the namespace and select creation mode as "Create a BPEL process from a Template".
    • Select the Template as Synchronous BPEL Process. 
    • Add the Service Address as http://localhost:8080/ode/processes/WSTest
        Click Finish.
 
Create BPEL Process
  • Add Invoke action and two Assign actions befre and after Invoke action to the BPEL process.Rename them as follows.

  • Download and copy the wsdl file of the targert webservice in to the project folder. (In this example it is AdderService.wsdl) . Refresh the eclipse project after adding that.
  • Click on InvokeWebService, in the Properties view, select Details->Partner Link->Create Global Partner Link. Name it as AdderServicePL. Click OK.
  • A pop-up dialog appears. In this step, you have to select the Partner Link Type Structure which is the Adder service. Then select the option From Project. Select the AdderService interface as the Partner Link Type Structure. Click OK.


  • Type the Partner Link Type Name as AdderServicePLT. Click Next.
  • Type the Role Name as AdderServicegPLRole, select the PingPong Port Type. Click Next.
  • Ignore the second Role of the Partner Link. Click Finish.
  • Continue with the Details of the InvokeWebService action. Select the Operation add at the Quick Pick area. Other two variables are automatically generated which are AdderServicePLRequest and AdderServicePLResponse. 
 
 
 
  • Double click on WSTestArtifacts.wsdl do the data type and parameter count changes for both input and output of the WSTest Service. This can be done by clicking the arrow at the right hand side of the box.
 
 
 
 
  •  Click on the AssignInputToWebService action. In the Properties view, select Details->New and assign the input->payload->input to AdderServicePLRequest->Parameters->input. A pop-up dialog appears to ask you about the variable initiation. Select Yes.
 
 
  • Do the same for select the AssignWSOutToResult action and assign the AdderServicePLResponse->parameters->Return to the output->payload->result.  
 
 
Service Declaration
 
  • Open WSTestArtifacts.wsdl and click on the binding between WSTestService and WSTest.  In properties tab click on Generate binding content and click ok.
 
  • Then select WSTestService and in Properties->General Change the Address as follows.
  • Save the files. Right click on the BPEL_WSTest project, select New->Others->BPEL 2.0->Apache ODE Deployment Descriptor. Click Next. Verify the BPEL Project name as /BPEL_WS. Click Finish.
    File deploy.xml is created now.
  • Right click on this file. Select Open With->ODE Deployment Descriptor Editor. At the Inbound Interfaces (Services), Partner Link is the client, select the Associated Port as WSTestPort and click on other field. Eclipse will automatically fill in other fields.
  • At the Outbound Interfaces (Invokes), Partner Link is AdderServicePL, select the Associated Port as AdderService.
Deploy the service.

  • Open the Server view in Eclipse, right click on the Ode v1.x Server at localhost, select Add and Remove Projects. Select the BPEL_WSTest in the Available projects box and click Add. Then, click Finish
  • Start the server and the wsdl of the process can be accessed from below url
http://localhost:8080/ode/processes/WSTest?wsdl