BPEL's example: Working with complex types and array type

This tutorial shows you how to use the complex types and array type in BPEL. We will examine this issue with a simple example: we input a list of members of a company and the BPEL process will return the number of inputed members and information of the last one. Each member is presented by a complex type with two fields: name and age.

Tools: Eclipse 3.6, BPEL Designer 0.5.0 Plugin, Tomcat 7.0.53, ODE 1.3.5

Project creation

  1. Create a new BPEL project named “BPEL_ComplexArray” by selecting File→New→Others→BPEL 2.0→BPEL Project. Select Next. Type the project name as BPEL_ComplexArray and select the Target Runtime as Apache ODE 1.x Runtime. Click Finish.
  2. Create a new BPEL process file named ComplextArraySample by right clicking on the BPEL_ComplexArray/bpelContent folder, select New→Others→BPEL 2.0→New BPEL Process File. Click Next. Fill in BPEL Process Name the string ComplextArraySample, and in the Namespace the string http://complexarray.bpel.tps. Click Next.
  3. Select the Template as Synchronous BPEL Processand modify the Service Address as http://localhost:8080/ode/processes/ComplextArraySample (suppose that your Tomcat environment is running on port 8080). Click Finish

Types declaration

  1. Open ComplextArraySampleArtifacts.wsdl file. Right click on ComplexArraySamplePort. Select show properties and make sure that the Address is http://localhost:8080/ode/processes/ComplexArraySample.
  2. Click on the arrow after the variable ComplexArraySampleRequest to open the Inline Schema of this variable.


  3. At the Outline View, right click on Types, select Add Complex Type. In the Properties View of this variable, change its name to People. Right click on the variable People, select Add Element. Set its name as name and type as string.


  4. Add another variable named age and type int.
  5. In the Outline view, select Elements→ComplexArraySampleRequest→local type→sequence→input. Then, in its Properties view, at Type, select Browse.. and browse it to People. Click OK.


  6. Similarity, change the type of Elements→ComplexArraySampleResponse→local type→sequence→result from string to People.


  7. But the input has to be the array of People and the result has to have another variable to hold the total number of members. So, we have to do a bit more. Click on the Elements→ComplexArraySampleRequest→local type→sequence, in its Properties view, select Minimum Occurrence is 1 (at least 1 member in the list) and the Maximum Occurrence is unbounded.


  8. Right click on Elements→ComplexArraySampleResponse→local type→sequence, select Add Element. Name it as total and select the type is int.


  9. That's all for the declaration step. Save the file and move to the BPEL Design.

BPEL design

  1. Open the file ComplextArraySample.bpel, drag an Assign action between the existing receiveInput and replyOutput.


  2. Click on the Assign, in its Properties view, select Details→New. Assign the expression count($input.payload/tns:input) to the output→payload→total. A pop-up dialog appears asking you about the variable initiation. Select Yes.


  3. Select New again, add the expression $input.payload/tns:input[last()] to the output→payload→result.
  4. That's all for the design. Save the BPEL file.

Project deployment

  1. Right click on the BPEL_ComplexArray/bpelContent, select New→Others→BPEL 2.0→Apache ODE Deployment Descriptor. Click Next. Verify the BPEL Project field as /BPEL_ComplexArray/bpelContent. Click Finish.
  2. Open the deploy.xml file. And select the Associated port with the Partner Link client is ComplexArraySamplePort.
  3. Save file and open the Server view, right click on the Ode v1.x Server at localhost, select Add and Remove Projects. Select the BPEL_ComplexArray in the Available projects box and click Add. Then, click Finish.
  4. Start the ODE server and use the Eclipse's Web Services Explorer to test our application. If you deploy the process successfully, you will see the result like the following:


  5. Done.

Exercices

  1. Deploy a “hotel agent” service which stores database about hotels in your region. Then, create a BPEL process to invoke this service: input is the place (or price) and output is list of hotels and their information which relate to the input.
teaching_assistant/bpel/bpel_s_example_-_working_with_complex_types_and_array_type.txt · Last modified: 2014/04/14 13:20 by IT Courses (NNC)
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0