Within the context of WebSphere, a business process is a choreographed set of activities that, collectively, represents a real-world business operation. Internally, the individual activities are defined using Web Services Description Language (WSDL), and the interactions between activities are defined using the Business Process Execution Language for Web Services (BPEL4WS) or Flow Description Markup Language (FDML).
WebSphere Studio Application Developer Integration Edition V5.1 (hereafter called Application Developer) supports the development of business processes using BPEL4WS. The BPEL standard is co-developed by IBM, Microsoft®, and BEA, and it provides an XML schema for creating business process. IBM extends the BPEL standard to include some useful components such as JavaSnippet and the Staff activity. The extended version is called BPEL+.
Application Developer supports both the BPEL and BPEL+ standards. It provides a graphical editor for assembling business processes, and a unit test environment in which processes can be executed and debugged. These tools provide everything you need to build business processes that can be deployed on the WebSphere Integration Test Server.
The rest of this article is organized as follows:
- What is BPEL? provides an overview of the components in BPEL by giving an example of a business process.
- Creating a simple BPEL process describes the steps of creating a business process.
- Invoking a Java service introduces a Java™ service into the business process.
- Invoking another business process describes how to invoke another business process within a business process.
Here is a sample business process described with BPEL in Application Developer:
Figure 1. Sample BPEL File in Application Developer

Figure 1 illustrates a number of activity nodes:
- Receive
- A BPEL process must have at least one Receive node, which is responsible for receiving input messages.
- Reply
- A BPEL process can optionally have a Reply node, depending on whether the process needs to provide a response.
- Empty
- The Empty node is basically a placeholder that does nothing.
- JavaSnippet
- This JavaSnippet node lets you write Java code. As mentioned before, this activity exists only in the BPEL+ standard.
- Sequence
- The elements inside a Sequence node will be executed sequentially. For example, the JavaSnippet node will be executed after Empty1.
- Flow
- The two blue bars that enclose Sequence1 and Sequence2 is a Flow node. Items inside a Flow node are executed in parallel. For example, Sequence1 and Sequence 2 will start execution at the same time.
A business process has a service definition in WSDL, which is a standard communication protocol in XML format. It defines services as a collection of network endpoints or ports. WSDL is also the standard communication protocol for Web services.
The WSDL definition contains the definitions for port types, operations, and message types. The port type describes the operations that the business process supports. Each operation has input and/or output messages defined. If you would have to think of it in Java terms, an operation is like a method in Java. Input message is like the input parameters for a method. And the output message can be thought of as a return type from a method.
Here is a default service definition that is generated by the BPEL creation wizard:
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://www.example.com/process50233470/interface/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.example.com/process50233470/interface/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema/"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
<message name="InputMessage">
<part name="contents" type="xsd:string"/>
</message>
<portType name="ProcessPortType">
<operation name="InputOperation">
<input name="Input" message="tns:InputMessage"/>
<output name="Output" message="tns:InputMessage"/>
</operation>
</portType>
</definitions>
|
With a WSDL service definition, a business process can be invoked by any applications that act as service clients. For example, a BPEL process can be invoked by another BPEL process.
Creating a simple BPEL process
In this section, you will create, deploy, and run a simple BPEL service.
Step 1. Create a service project
Create a service project named SimpleServiceProject.
- In the Business Integration perspective, select File => New => Service Project.
- Enter
SimpleServiceProjectas the project name and click Finish.
Step 2. Create a dervice definition using WSDL
As mentioned above, each BPEL process needs to have a WSDL definition so that the port types and operations are exposed for external invocations.
- In the Business Integration perspective -- Services view, expand Service Projectsand right-click on SimpleServiceProject and select New => Empty Service.
- Enter
validatorprocessas the Package name. - Enter
MailValidatoras the File name. Click Finish. - Go to the Graph view in the
MailValidator.wsdleditor. - Right-click inside the Port Types column => Add Child => Port Type. Enter
MailValidatorPortTypeas the name and click OK. - Right click on the MailValidatorPortType => Add Child => operation. Enter
ValidateOperationas the name and click OK. - Right click ValidateOperation => Add Child => Input.
- Right click on Input => Set Message. Take the default value to create a new WSDL message and click Finish.
- In the Messages column, right click on ValidateOperationRequest => Add Child => Part. Enter
SenderAddressas the part name. Click OK. Notice that the message part by default has a type of xsd:string which is a built-in xsd type. - Add another part. Right click on ValidateOperationRequest => Add Child => Part. Enter
ReceiverAddressas the part name. Click OK. - In the Port Types column, right click on ValidateOperation => Add Child => Output. If the service is asynchronous, then an output is not required. However, since this service is synchronous, you will need to create an output to return a response to the caller.
- Right click on Output => Set Message. Take the default values to create a new WSDL message and click Finish.
- In the Messages column, right click on ValidateOperationResponse => Add Child => part. Enter
MailToAddressas the part name. Click OK. - Save the WSDL file and close the editor.
Figure 2. MailValidator.wsdl

A BPEL process can be sequence-based or flow-based. In this step, you will create a sequence-based process. In a sequence-based BPEL process, all items in the process are encapsulated in a sequence. On the other hand, all items in a flow-based BPEL process are encapsulated in a flow.
- In the Business Integration Perspective - Services view, expand on Service Projects => right click on SimpleServiceProject => New => Business Process.
- Enter
validatorprocessas the package name andMailValidatorProcessas the File name. Click Next. - Select Sequence-based BPEL Process. Click Finish.
The Business Process Creation wizard creates a default WSDL service definition for the newly created BPEL process. The default service definition has some made-up port type, operations and messages defined. However, you will not be using the default one; you will use the WSDL service definition that was defined in Step 2. Therefore, clean up of the BPEL process and the default WSDL file are needed.
- In the
MailValidatorProcess.bpeleditor, right click on InputVariable => Delete. - Right click on PartnerLink => Delete.
- Open
MailValidatorProcesInterface.wsdlinto an editor. Right click on ProcessPortType => Delete. - Right click on InputMessage => Delete.
- Save both the WSDL and BPEL files. Close the WSDL file.
Step 4. Create a PartnerLink for the BPEL Process
One of the important use cases for BPEL is the ability to interact with other services through the Web Service Interface. These other services that a BPEL process can interact with are called Partners. Before a BPEL process can invoke a Partner, it needs to first define a PartnerLink to reference the Partner's WSDL interface. Furthermore, each BPEL process needs to define a PartnerLink that represents itself which points to its own WSDL interface. Therefore, for every BPEL process, it must have at least one PartnerLink that describes itself. If the process invokes other services, each of those services would require a PartnerLink definition.
Create a PartnerLink for this BPEL Process that represents itself.
- In the
MailValidatorProcess.bpeleditor, click on the Plus icon to create a new PartnerLink. - Enter
MyProcessas the Partnerlink name. Click Enter - In the detailed area of the editor, go to the Implementation page. Click on New PartnerLink Type. A PartnerLink Type defines the role of the services and the port type.
- Enter
MyRoleas the First role name. - Click on Browse to choose a Port Type file. Select SimpleServiceProject => validatorprocess => MailValidator.wsdl => MailValidatorPortType. This is the port type that we defined in Step 2. Click OK.
- Click on the
<-->button to move MyRole to the right. The left hand side is for the Partners that the process invokes. The right hand side is for the PartnerLink that represents itself. Save the BPEL process.
Figure 3. Mail Validator PartnerLink

A BPEL variable can be a WSDL message type or XSD element type. You can create WSDL message type variable using the editor. All variables in WSDAIE v5.1 are global variables. However, later version of Application Developer may introduce scoped variables.
Create a variable for the input and output messages.
- In the MailValidatorProcess.bpel editor, click on the Plus icon to create a new Variable.
Enter
ValidateOperationRequestas the variable name. - Go to the Message page in the detail area. Click on Browse => expand SimpleServiceProject => expand validatorprocess => MailValidator.wsdl => select ValidateOperationRequest. Click OK.
- Add another variable named
ValidateOperationResponse. - Click on Browse => expand SimpleServiceProject => expand validatorprocess => MailValidator.wsdl => select ValidateOperationResponse. Click OK.
- Save the BPEL file.
Step 6 - Modify Receive and Reply
When a BPEL process receives an input message from the client through the Receive node, it will create a new BPEL process instance and the BPEL process is started. The Reply node would send an output message back to the client. As mentioned previously, this process is synchronous and therefore it has a both the Receive and Reply nodes. You need to specify the port type, operation and message in the Receive and Reply nodes. A BPEL process actually allows multiple receive and reply nodes, but this is an advanced topic related to correlation sets which is outside the scope of this tutorial.
- Select the Receive node. Go to the Implementation page in the detailed pane. Select MyProcess as the Partner Link.
- Select ValidateOperationRequest as the Request.
- Make sure the check box for Create a new Process instance if one does not already exist is checked.
- Select the Reply node. Go to the Implementation page in the detailed pane. Select MyProcess as the Partner Link.
- Select ValidateOperationResponse as the Response.
- Save the BPEL file. There should be no more red crosses on the BPEL process.
Figure 4. Modify Receive and Reply

Step 7 - Complete the BPEL Process
You can add the basic nodes to the BPEL process using the icon menu items located on the left hand side of the editor. Alternatively, you can use the context menu to add new nodes.
The BPEL process that we are creating in this section validates the mailing addresses. If the ReceiverAddress from the ValidateOperationRequest consists of the word "Toronto" or "Markham", it will set the MailToAddress in the ValidateOperationResponse to the ReceiverAddress. Otherwise, the mail will be returned to the sender and the MailToAddress will be set to the SenderAddress.
- Add a Switch node after the Receive node. Right click on the Reply node => Insert Before => Switch. Alternatively, you can locate the Switch node in the 3rd icon menu and simply drop it after the Receive node. Figure 5 shows the location of the icon menu.
- Right click on Switch => Add Case.
- Add another case. Right click on Switch => Add Case.
- Right click on Switch => Add Otherwise.
Figure 5. Editor's Icon Menu
Enter a Visual Expression for the first Case.
- Click on the first Case node and go to the Condition page. You can enter a Java expression or Visual expression for this case. Select Visual Expression in the drop-down box.
- You can access the contents of the messages via the variables that are listed on the right hand pane. Click on the blue Condition link => expand on ValidateOperationRequest => select ReceiverAddress.
- Select Method or Field.
- Select indexOf(ch...).
- Click on the blue link ch... and click on String on the right hand pane. Enter
Toronto. - Place the cursor after the close bracket. Select on > on the right hand pane.
- Select Number. Enter
-1. Save the BPEL file. - The final visual Expression looks like this. This expression will return true if the ReceiverAddress has the word "Toronto" in it.
Figure 6. Visual Expression in Case1

Enter a Java Expression for the second Case.
- Click on the second Case node and go to the Condition page. Select Expression from the drop-down box.
- Enter the following code snippet in the editor:
String receiverAddr = getValidateOperationRequest().getReceiverAddress(); if (receiverAddr.indexOf("Markham")>-1) { return true; } return false; - This code snippet will return true if the sender address has the word Markham in it. Save the BPEL file.
Add JavaSnippet node to the first Case
- Right click on the first Case => Add => Java Snippet. A Java Snippet allows you to enter Java code. It is not from the standard BPEL specification, but it's from the IBM BPEL+ specification.
- Click on JavaSnippet and go to the implementation page:
// Set the MailToAddress in the response to the ReceiverAddress from Request String receiverAddr = getValidateOperationRequest().getReceiverAddress(); ValidateOperationResponseMessage msg = getValidateOperationResponse(); msg.setMailToAddress(receiverAddr); setValidateOperationResponse(msg);
- If you have compilation error, right click inside the editor => Source => Organize Imports. This will automatically figure out if imports are needed to fix the compilation errors.
- This code snippet will copy the ReceiverAddress from the request to the response's MailToAddress. Save the BPEL File.
Add an Assign node to the second Case. In the first case, a Java Snippet node was used to copy values between variables. This is not the only way; you could also use an Assign node to do the same thing.
- Right click on the second Case => Add => Assign.
- Click on Assign and go to the implementation page. Select Variable or Part in the From drop-down box.
- Expand ValidateOperationRequest until you see ReceiverAddress. Select ReceiverAddress.
- Select Variable or Part in the To drop-down box.
- Select MailToAddress from ValidateOperationResponse. This would copy the ReceiverAddress from request to the MailToAddress in response.
Figure 7. Assign Node Implementation

Add an Assign node to Otherwise.
- Right click on the second Case => Add => Assign.
- Click on Assign and go to the implementation page. Select Variable or Part in the From drop-down box.
- Select SenderAddress from ValidateOperationRequest.
- Select Variable or Part in the To drop-down box.
- Select MailToAddress from ValidateOperationResponse.
Add a JavaSnippet node before the Reply node. This JavaSnippet will simply print everything to the System out.
- Right click on Reply => Insert Before => Java Snippet.
- Enter the following code snippet into the editor. Save the BPEL file.
String receiverAddress = getValidateOperationRequest().getReceiverAddress();
String senderAddress = getValidateOperationRequest().getSenderAddress();
String mailtoAddress = getValidateOperationResponse().getMailToAddress();
System.out.println ("Receiver Address: " + receiverAddress);
System.out.println ("Sender Address: " + senderAddress);
System.out.println ("Mail To Address: " + mailtoAddress);
|
The BPEL process is completed. The next step is to generate deploy code and test it in the Server.
Figure 8. A completed version of MailValidator.bpel

Step 9. Generate Deployed Code
In order to run the BPEL process in the WebSphere Integration Test Server, you must generate deployed code. This step will create an EAR and EJB for the BPEL process which can then be deployed to the test server.
- In the Services view, right click on MailValidatorProcess.bpel => Enterprise Services => Generate Deploy Code.
- Accept all the default settings and click OK. After the code generation, you should see three projects created: SimpleServiceProjectEAR, SimpleServiceProjectEJB and SimpleServiceProjectWeb.
Step 10. Deploy to Test Server
Create an Integration Test Environment server named IT Server.
- In the Servers view, right click => New => Server and Server Configuration.
- Select WebSphere version 5.1 => Integration Test Environment.
- Enter
IT Serveras the server name. Click Finish. - Add the EAR Project to Server. Right click on IT Server => Add and remove projects.
- Click on Add All. Click Finish.
- Start Server. Right click on IT Server => Start.
- After the server is started. Open the BPE Web client. You can open it using the context menu on the server. Right click on IT Server => Launch Business Process Web Client. Alternatively, you can enter this URL in the Web browser - http://localhost:9080/bpe/webclient.
- Click on My Templates.
- Select MailValidatorProcess => Start Instance.
- Enter
123 Queen St., Torontoas the ReceiveAddress. - Enter
8200 Warden Ave., Markhamas the SenderAddress. - Click Start Instance to create a new instance of the BPEL process.
- As you can see from the console, the
MailToAddressis set to123 Queen St., Torontobecause theReceiverAddresscontains the wordToronto:Receiver Address: 123 Queen St., Toronto Sender Address: 8200 Warden Ave., Markham Mail To Address: 123 Queen St., Toronto
- 8. Let's run this again. Enter 123 Queen St., North York as the ReceiverAddress. This receive address is not considered as valid by
the process; therefore, the MailToAddress is set to 8200 Warden Ave., Markham.
Receiver Address: 123 Queen St., North York Sender Address: 8200 Warden Ave., Markham Mail To Address: 8200 Warden Ave., Markham
In this section, you have completed a simple BPEL process. In the next sections, you will create a long running BPEL process that would invoke a Java Web Service and another BPEL process.
If you have the server running, stop the Server before continuing this section.
In this section, you will invoke a Java Service from a BPEL process. So before creating the BPEL process, you need to create the Java Service first.
Step 1. Create a Java Web Service
Create a Java Project named MailJavaProject.
- From the workbench, select File => New => Project. Select Java => Java Project. Click Next.
- Enter
MailJavaProjectas the Project name. Click Finish.
Create a Java Class named MailHelper.
- In the Package Explorer view, right click on MailJavaProject => New => Class.
- Enter
implementationas the package name. - Enter
MailHelperas the class name. Click Finish. - Add the following method into the class and save the file.
public void mail(String mailToAddress) { System.out.println ("Sending mail to " + mailToAddress); }
Create a Service Interface for the Java Class.
- From the workbench, select File => New => Other => Business Integration => Service built from.
- Select Java and click Next.
- Browse for MailJavaProject for the Class Project name.
- Browse for implementation.MailHelper for the Java Class name.
- Select the checkbox for mail(String). Click Next.
- Click Finish.
Step 2. Create a Service Project
Create a Service Project named PostOfficeProject.
- In the Business Integration Perspective, select File => New => Service Project.
- Enter
PostOfficeProjectas the project name and click Finish.
Step 3. Create a WSDL Service Definition for the BPEL Process
- In the Business Integration Perspective - Services view, expand on Service Projects => right click on PostOfficeProject => New => Empty Service.
- Enter
postofficeprocessas the package name. - Enter
PostOfficeas the File name. Click Finish. - Switch to the Graph view in the
PostOffice.wsdleditor. - Right click on the Port Types column => Add Child => Port Type. Enter
PostOfficePortTypeas the name and click OK. - Right click on the PostOfficePortType => Add Child => operation. Enter
SendMailOperationas the name and click OK. - Right click SendMailOperation => Add Child => Input.
- Right click on Input => Set Message. Take the default value and click Finish.
- In the Messages column, right click on SendMailOperationRequest => Add Child => Part. Enter
SenderAddressas the part name. Click OK. - Add another part. Right click on SendMailOperationRequest => Add Child => Part. Enter
ReceiverAddressas the part name. Click OK. - In the Port Type column, right click on SendMailOperation => Add Child => Output.
- Right click on Output => Set Message. Take the default value and click Finish.
- In the Message column, right click on SendMailOperationResponse => Add Child => Part. Enter
MailToAddressas the part name. Click OK. - Save the WSDL file and close the editor.
Figure 9. Port Type for Port Office PartnerLink

Create a BPEL Process named PostOfficeProcess
- In the Business Integration Perspective - Services view, expand on Service Project => right click on PostOfficeServiceProject => New => Business Process.
- Enter
postofficeprocessas the package name andPostOfficeProcessas the file name. Click Next. - Select Flow-based BPEL Process. Click Finish.
Clean up the default values in the BPEL process.
- In the
PostOfficeProcess.bpeleditor, right click on InputVariable => Delete. - Right click on PartnerLink => Delete.
- Open
PostOfficeProcessInterface.wsdlinto an editor. Right click on ProcessPortType => Delete. - Right click on InputMessage => Delete.
- Save the WSDL and BPEL files. Close the WSDL file.
Figure 10. Clean up the default values in the BPEL process

Step 5. Create a PartnerLink for the BPEL Process
Create a PartnerLink for this BPEL Process that represents itself.
- In the
PostOfficeProcess.bpeleditor, click on the Plus icon to create a new PartnerLink. - Enter
MyProcessas the Partnerlink name. Click Enter. - In the detailed area of the editor, go to the Implementation page. Click on New PartnerLink Type.
- Enter
MyRoleas the First Role name. - Click on Browse to choose a Port Type file. Select PostOfficeServiceProject => postofficeprocess => PostOffice.wsdl => PostOfficePortType.
- Click OK to close the Partner Link Type creation dialog.
- Click on the <--> button to move MyRole to the right. Save the BPEL process.
Figure 11. PostOffice PartnerLink

Create a variable for the input and output messages.
- Click on the Plus icon to create a new Variable named
SendMailOperationRequest. - Go to the Message page in the detail area. Click on Browse => expand PostOfficeServiceProject => expand postofficeprocess => PostOffice.wsdl => select SendMailOperationRequest. Click OK.
- Add another variable named
SendMailOperationResponse. - Click on Browse => expand PostOfficeServiceProject => expand postofficeprocess => PostOffice.wsdl => select SendMailOperationResponse. Click OK.
- Save the BPEL file.
Step 7. Modify Receive and Reply Nodes
- Select the Receive node. Go to the Implementation page in the detailed pane. Select MyProcess as the Partner Link.
- Select SendMailOperationRequest as the Request.
- Make sure the check box for Create a new Process instance if one does not already exist is checked.
- Select the Reply node. Go to the Implementation page in the detailed pane. Select MyProcess as the Partner Link.
- Select SendMailOperationResponse as the Response.
- Save the BPEL file. There should be no more red crosses on the BPEL process.
Step 8. Modify the BPEL Process Settings
- Select the oval node labeled PostOfficeProcess at the top of the editor. Go to the Server page in the detailed pane.
- Select the check box for Process is long-running.
- Select the check box for Automatically delete process after completion. If this check box is not selected, then the process instances will not be deleted automatically. You will need to manually clean them up using the Web client.
A BPEL process can be long-running (macroflow) or short-running (microflow). A long-running process can run for a long period of time. An example of a long-running process could be mortgage approval which may involved human interactions and could take days. The steps to model a long-running and short-running process are more or less the same. Simply by changing the attributes in the BPEL Process Server page would make a short running process long-running. The major difference exists in deployment. When deploying a long running process to the Integration Test Server, you will need to create datasources and tables before you can run the process. The reason for that is long-running processes are run as container-managed EJBs (CMPs), which are persisted in a database. Short-running processes are run as a Session EJB which does not need database tables.
Step 9. Create a PartnerLink and Invoke for the Java Web Service
Create a Partner Link named MailJavaProcess. This partnerlink will reference the WSDL definition for the
Java Web Service.
- Create a new Partner Link named
MailJavaProcess. - Go to the implementation page for MailJavaProcess PartnerLink. Create a New Partner Link Type.
- Enter
MailJavaProcessRoleas the First Role name. - Browse to MailJavaProject => implementation => MailHelper.wsdl. Select MailHelper as the port type. Click OK. Note that the left hand side is for Partner.
Figure 12. MailJavaProcess PartnerLink

Create Variables for the Java Web Service. These variables are used to communicate with the Java Web Service.
- Create a variable name
MailRequest. Select the message to be MailJavaProject => Implementation => MailHelper.wsdl => mailRequest. - Create a variable name
MailResponse. Select the message to be MailJavaProject => Implementation => MailHelper.wsdl => mailResponse.
Create an Invoke node.
- Delete the purple link between the Receive and Reply node.
- Add an Invoke node anywhere inside the Flow. Or you can right click on the Flow => Add => Invoke.
- Select on the Invoke node. Go to the implementation page.
- Select MailJavaProcess as the Partner Link.
- Select MailRequest as the request and MailResponse as the response.
- Add an Assign node. Right click on the Flow => Add => Assign.
- Right click on Receive => Set Links between Flow activities => select Assign.
- Right click on Assign=> Set Links between Flow activities => select Invoke.
- Right click on Invoke=> Set Links between Flow activities => select Reply.
- Right click on the Flow => Align Flow Contents Automatically.
Figure 13. PostOfficeProcess.bpel with Java Invoke

Complete the implementations for Assign.
- Click on Assign and go to the implementation page. Select Variable or Part in the From drop-down box.
- Select ReceiverAddress from SendMailOperationRequest.
- Select Variable or Part in the To drop-down box.
- Select MailToAddress from MailRequest.
- Save the BPEL file.
Figure 14. Assign Implementation

Let's do a quick run before continue building the BPEL Process.
- In the Services view, right click on PostOfficeProject => Properties => Java Build Path => Check MailJavaProject. Click OK.
- Right click on PostOfficeProcess.bpel => Enterprise Services => Generate Deploy Code.
- Select MailJavaProcess => Browse => MailJavaProject => implementation => MailHelperJavaService.wsdl
- Click OK.
- Add the EAR Project to Server. Right click on IT Server => Add and remove projects.
- Click on Add All. Click Finish.
- Right click on the IT Server => Create tables and data sources. This step is necessary because this BPEL process is long-running. You will not need to do this step for short-running process like the one created in Section 1.
- Start Server. Right click on IT Server => Start.
- Start the BPE Web Client http://localhost:9080/bpe/webclient.
- Click on My Templates. Select PostOfficeProcess => Start Instance.
- Enter something in the address. And you shall see the Java Web Service being invoked from the console.
Invoking another business process
This section is a continuation from the previous section. You will be using the same service project and BPEL file. This section will expand the BPEL process created in Section 4 to a composite one that invokes the BPEL process MailValidatorProcess created in Section 3. Stop the server if it's running.
Step 1. Create a PartnerLink and Invoke for the BPEL Service
Create a Partner Link named MailValidatorProcess
- In the
PostOfficeProcess.bpeleditor, create a new Partner Link namedMailValidatorProcess. - Go to the implementation page for MailValidatorProcess Partner Link. Click on New to create Partner Link Type.
- Enter
MailValidatorProcessRoleas the First Role name. - Browse to SimpleServiceProject => validatorprocess => MailValidator.wsdl. Select MailValidatorPortType as the port type. Click OK.
Figure 15. MailValidatorProcess PartnerLink

Create Variables for the BPEL Process
- Create a variable named
ValidatorOperationRequest. Select the message to be MailJavaProject => Implementation => MailValidator.wsdl => ValidatorOperationRequest. - Create a variable named
ValidatorOperationResponse. Select the message to be MailJavaProject => Implementation => MailValidator.wsdl => ValidatorOperationResponse. - Save the BPEL file.
Add new nodes to the BPEL process. This example will do an Invoke call to the BPEL MailValidatorProcess to validate the mailing address before invoking the Java Web Service MailJavaProcess that sends the mail.
- Delete the Assign node.
- Add an Invoke node inside the Flow and name it
MailValidatorInvoke. - Add an Assign node inside the Flow and name it
MailValidatorAssign. - Add another Assign node inside the Flow and name it
JavaInvokeAssign. - Create a link connection from Receive to MailValidatorAssign.
- Create a link connection from MailValidatorAssign to MailValidatorInvoke.
- Create a link connection from MailValidatorInvoke to JavaInvokeAssign.
- Create a link connection from JavaInvokeAssign to Invoke.
Figure 16. PostOfficeProcess.bpel

Modify MailValidatorAssign. This Assign node copy the values from SendMailOperationRequest to ValidatorOperationRequest. This provides the input values for the MailValidatorInvoke.
- Select MailValidatorAssign and go to the implementation page. Select Variable or Part in the From drop-down box. Choose SendMailOperationRequest => SendMailOperationRequest => SenderAddress.
- Select Variable or Part in the To drop-down box. Choose ValidatorOperationRequest => ValidatorOperationRequest => SenderAddress.
- Click on New to create a second assign rule.
- Select Variable or Part in the From drop-down box. Choose SendMailOperationRequest => SendMailOperationRequest => ReceiverAddress.
- Select Variable or Part in the To drop-down box. Choose ValidatorOperationRequest => ValidatorOperationRequest => ReceiverAddress.
Modify MailValidatorInvoke
- Select MailValidatorInvoke and go to the implementation page. Select MailValidatorProcess from the Partner Link drop-down box.
- Select ValidatorOperationRequest as the Request.
- Select ValidatorOperationResponse as the Response.
Modify JavaInvokeAssign. This Assign node copy the values from ValidatorOperationResponse to MailRequest. This provides the input values for the MailJavaInvoke.
- Select JavaInvokeAssign and go to the implementation page. Select Variable or Part in the From drop-down box. Choose ValidatorOperationResponse => ValidatorOperationResponse => MailToAddress.
- Select Variable or Part in the To drop-down box. Choose MailRequest => mailRequest => mailToAddress.
- Save the BPEL file.
- In the Services view, right click on PostOfficeProject => Properties => Java Build Path => Check SimpleServiceProject. Click OK.
- Right click on PostOfficeProcess.bpel => Enterprise Services => Generate Deploy Code.
- Select MailJavaProcess => Browse => MailJavaProject => implementation => MailHelperJavaService.wsdl
- Select MailValidatorProcess => Browse => SimpleServiceProject => validatorprocess => MailValidatorProcess_MailValidatorPortType_EJB.wsdl
- Click OK.
- Add the EAR Project to Server. Right click on IT Server => Add and remove projects.
- Click on Add All. Click Finish.
- Right click on IT Server => Create tables and data sources. This step is necessary because this BPEL process is long-running.
- Start Server. Right click on IT Server => Start.
- Start the BPE Web Client and create an instance for PostOfficeProcess.
- Enter
123 Front St., Torontoas the ReceiverAddress and8200 Warden Ave., Markhamas the SenderAddress. - You will see the following in the output console. The process will go to the BPEL process MailValidatorProcess
to validate the address and then invoke the Java Web Service MailJavaProcess to send the mail.
Receiver Address: 123 Front Toronto Sender Address: 8200 Warden Ave. Markham Mail To Address: 123 Front Toronto Sending mail to 123 Front Toronto
This tutorial has only covered the basics of the creating simple BPEL processes. You have created a simple business process that invokes a Java Partner and a BPEL Partner. In the tutorial, these partners are located in the same server. In fact, the partners can exist in different servers that are unknown to the business process. You can even expose your BPEL process as Web service such that it can be invoked by other potential partners. The tools in WebSphere Studio Application Developer Integration Edition let you develop, integrate and test business processes with ease.
- Business Process Execution Language for Web Services (BPEL4WS)
specification -- Public draft Version 1.1 from a cross-industry workgroup
- Web Services Description Language (WSDL) standard -- Version 1.1
from the World Wide Web Consortium (W3C)
- Browse for books on these and other technical topics.
Jane Fung is a software developer at IBM Toronto Lab. She works on debug tools in WebSphere Studio Application Developer Integration Edition, and her expertise includes BPEL and business rules. She is a Java 2 Certified and has a Electrical Engineering degree from the University of Waterloo. You can reach Jane at jcyfung@ca.ibm.com.
Colin Yu is a Technical Designer at IBM Toronto Lab. He uses business scenarios to help define integration requirements for IBM software products. He received a Bachelor of Engineering degree in 1995 and a Master of Applied Science degree from the University of Waterloo, Ontario in 2000. Colin is an IBM Certified Enterprise Developer and a System Expert on WebSphere Application Server. You can reach Colin at coliny@ca.ibm.com.
Comments (Undergoing maintenance)





