Click here to Skip to main content
12,894,219 members (82,907 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


15 bookmarked
Posted 27 Feb 2009

An Example Of BPEL invoking WebService

, 27 Feb 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
The example below shows how to invoke an existing/external web service in BPEL. This example uses Eclipse, Eclipse BPLE designer Plug-In and Apache ODE.


The example below shows how to invoke an existing/external web service in BPEL. This example uses Eclipse, Eclipse BPLE designer Plug-In and Apache ODE.


Using the Code

There are two parts in this article:

  • Part A: Prepare a Web Service
  • Part B: Invoke this web service in BPEL

Part A: Prepare Web Service

  1. Create a web service “DoSomethingWebService”, which has only one class “DoSomething” (under namespace “ws.example”) with only one method “doSomething”. You can use the bottom-up approach to build this web service. Please see this link.
    package ws.example;
    public class DoSomething {
                public String doSomething(String myinput)
                            System.out.println("doSomething is called");
                            return "doSomething is called ";
  2. Check the generated WSDL file, the service name is “DoSomethingService”, Port “DoSomething”, binding address is http://localhost:8080/DoSomethingWebService/services/DoSomething.

    Figure 1: "DoSomethingService" Web Service
  3. Export the service to a war file and deploy it under $TomcatHome/webapps. If you like to, export and deploy the test client also, it is good for testing. Please see this link.

Part B: Invoke this Web Service in BPEL

  1. Prepare ODE and BPEL Plug-In and create a BPEL project “InvokeWebServiceProj” and a synchronous BPEL process “Caller” under namespace “”. Please see this link.
  2. Import DoSomething.wsdl into the project and create a partner link “DSLink” of type “DSLinkType”, Partner Role of “DSProvider”. Please see this link.

    Figure 2: “DSLinkType”
  3. Add Assign, Assign1 and Invoke Block in “Caller” process:

    Figure 3: "Caller" BPEL Process
  4. Edit Invoke Block to call “doSomething”.

    Figure 4: "Invoke" Block
  5. Initialize “DSLinkRequest” from “Assign” block, choose From->Fixed Value and To->DSLinkRequest>parameters. The fixed value is described as:
    <xsd:doSomething xmlns:xsd="">

    Figure 5: Initialize “DSLinkRequest”
  6. Set the input value for “doSomething” method. Choose From->Variable->input->payload->input and To->Variable->DSLinkRequest->parameters->myinput.

    Figure 6: Set “myinput” for “DSLinkRequest”
  7. Initialize “output” from “Assign1” block. Choose From->Fixed Value and To->output>payload. The fixed value is described as:
    <tns:CallerResponse xmlns:tns="">

    Figure 7: Initialize “output”
  8. Set the output value for “Caller” process. Choose From->Variable->DSLinkResponse->parameters->dosomethingReturn and To->Variable->output->payload->result.

    Figure 8: Set “result” for “output”
  9. Edit the Caller.wsdl generated, so that a “CallerService” of port “CallerPort” is bound to the “Caller” process with the address “http://localhost:8080/ode/processes/Caller” using SOAP.

    Figure 9: "CallerService" Web Service
  10. Create deploy.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <deploy xmlns=""
      <process name="pns:Caller">
        <provide partnerLink="client">
          <service name="pns:CallerService" port="CallerPort"/>
        <!-- If there is a BPEL process which is also deployed under the same project-->
        <!--<provide partnerLink="DSLink">
          <service name="wns:DoSomethingService" port="DoSomething"/>
        <!-- DoSomethingService is an existing/external Web Service -->
         <invoke partnerLink="DSLink">
              <service name="wns:DoSomethingService" port="DoSomething"/>
         <cleanup on="always" />
  11. Test.

    Figure 10: Test Result

    Here is the complete list of the files of BPEL project (Caller.bpelex, Caller.wsdl and CallerArtifacts.wsdl are generated).

    Figure 11: File List


  • 27th February, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

Generalerror Pin
Member 79024486-May-11 5:47
memberMember 79024486-May-11 5:47 
GeneralI can't find the Caller.wsdl Pin
laimu28-Jul-09 4:17
memberlaimu28-Jul-09 4:17 
GeneralRe: I can't find the Caller.wsdl Pin
dongqiu19-Dec-09 20:21
memberdongqiu19-Dec-09 20:21 
GeneralRe: I can't find the Caller.wsdl Pin
deenaaaaaaaaaa13-Mar-12 23:06
memberdeenaaaaaaaaaa13-Mar-12 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 27 Feb 2009
Article Copyright 2009 by Snail2009
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid