Synchronous BPEL Process Tutorial
A Synchronous BPEL Process is one which you call and wait for the reply before proceeding further.
This is used in real time processing of services.
Anil has done an excellent job in making us create a HelloWorld.
I have created a similar HelloWorld for our use.
We will call the same HelloWorld process created earlier. As this process gives us a reply in real time, this can be used as a synchronous process.
We will run through the process and I will do a post-mortem / autopsy at important places to explain what we accomplished.
Our Intention :
1) Pass Input = Sudeept
2) Call HelloWorld process with input in parent process
3) Receive output from HelloWorld process synchronously
4) Store the output in parent process output variable.
Create a BPEL Process Name : SynchronousHelloWorld

Right Click on Application (in my case Apps2Fusion) è New è Choose “BPEL” è Choose “BPEL Process Project” è OK

Name = SynchronousHelloWorld
Namespace = (default)
Template = Synchronous BPEL Process
Choose Next

For simplicity lets continue to use default input and output schema elements
Choose Finish
A New synchronous BPEL Process is created as below :
(If you cannot see the process diagram, open your Application -> Project -> Integration Content -> double click on SynchronousHelloWorld.bpel

Lets understand what we have accomplished.
To make life easier, I will choose simplicity and analogy over technicalities.
We created a Application, think of it as a windows folder
We created a Project, this will evolve to become a Synchronous BPEL Process. Think of this as a procedure.
While creating the project we used the default values for InputSchemaElement = SynchronousHelloWorldRequestMessage and OutputSchemaElement = SynchronousHelloWorldResponseMessage
Think of these as input variable and output variable.
We already have 2 nodes created:
1) receiveInput ( This receives the input)
2) replyOutput (This generates output)
If you double click on receiveInput or replyOutput, you will see each of them has only one variable.


To evolve the skeletal process into a Synchronous process, we will call the Hello World BPEL Process created earlier.
To do that, on the right side in Component Palette, choose Process Activities
Drag and drop Invoke activity from the component palette in between receiveInput and replyOutput.

Our BPEL Process should look like :

The Invoke Process will call our earlier created HelloWorld process.
Lets add a service to represent HelloWorld in our BPEL Process.
In Component Palette, choose Services.

Choose PartnerLink and drag and drop on the right side of BPEL Process – grey color area called Services.

This PartnerLink is a place holder for HelloWorld process.
Double click on the partner link
Name : HelloWorld
To link this place holder to the HelloWorld Process, click on the torch icon above WSDL File:

Make sure you are connected to your IS Server.
We will connect to the IS Server and select the already deployed HelloWorld Process
BPEL Services è <IS Server Name> è processes è default è HelloWorld
Choose OK.

The Partner Link will populate the WSDL file and the Link Type.
Partner Role : HelloWorldProvider
My Role : <blank>
Note that My Role is blank for Synchronous Service.

Choose Apply/OK
Our BPEL Process will look like this :

You will see the new name for PartnerLink taking effect on the BPEL Process
Now we will link the Invoke activity to the partner link (HelloWorld) created.
Double click on Invoke activity
Name : InvokeHelloWorld
Partner Link : click on torch icon è Choose HelloWorld

We will choose default values for Input Variable and Output Variable.
We can do that by just clicking on the create item icon ( pencil and + ) for both Input Variable and Output Variable.

Our Synchronous Process will look something like this when done.

Lets understand what we did.
First we created a skeleton process
Then we created a invoke activity to call HelloWorld BPEL Process.
The input variable for our process is inputVariable ( used in receiveInput)
The output variable for our process is outputVariable (used in replyOutput)
The input variable for InvokeHelloWorld is InvokeHelloWorld_process_InputVariable
The outputvariable for InvokeHelloWorld is InvokeHelloWorld_process_OutputVariable
Our intention is to use the value in inputVariable(lets say “Sudeept”) and get a response “Hello World <inputVariable>” ( “Hello World Sudeept” in our case).
The value in is InvokeHelloWorld_process_InputVariable will be input to HelloWorld process and the output of HelloWorld process will be stored in InvokeHelloWorld_process_OutputVariable.
The disconnect is, how will we assign the value in inputVariable ( used in receiveInput) to InvokeHelloWorld_process_InputVariable ? and then how will we assign the value in InvokeHelloWorld_process_OutputVariable to outputVariable (used in replyOutput).
To fix the disconnect we will have to copy the value in inputVariable to InvokeHelloWorld_process_InputVariable and copy the value in InvokeHelloWorld_process_OutputVariable to outputVariable. This can be done by using Assign activity
Drag and Drop a Assign activity between receiveInput and InvokeHelloWorld

Double click on Assign activity
Name : AssignInputHW

Go to Copy Operation Tab.

Click on Create è Copy
On the From side :
Variablesè Processè Variablesè inputVariableèpayloadè client:SynchronousHelloWorldProcessRequestè client:input
On To side :
Variables è Processè Variables è InvokeHelloWorld_process_InputVariable è payload è ns1:HelloWorldProcessRequest è ns1:input
As can be understood, we are copying the value in inputVariable into InvokeHelloWorld_process_InputVariable
Choose OK

Choose OK

Now we will add a similar assign activity to copy output of HelloWorld into outputVariable.
Drag and drop a Assign activity between InvokeHelloWorld and replyOutput.
Double click on the Assign activity to rename it to AssignOutputHW

Go to Copy Operation tab.
Click on Create è Copy
On the From side :
Variables è Processè Variables è InvokeHelloWorld_process_OutputVariable è payload è ns1:HelloWorldProcessResponse è ns1:result
On To side :
Variablesè Processè Variablesè outputVariableèpayloadè client:SynchronousHelloWorldProcessResponseè client:result
As can be understood, I am copying the value in InvokeHelloWorld_process_OutputVariable into outputVariable
Choose OK

Now we will compile and deploy our SynchronousHelloWorld BPEL Process.
Right click on the process and select Make
After you get 0 Errors and 0 Warnings on the Messages box, right click on the Project (SynchronousHelloWorld)è select “Deploy”è <IS Name> è Deploy to default domain.

On the Apache ant tab below, you should see BUILD Successful.

When the BPEL Process is deployed, we will have to test it.
Go to IS Server where our BPEL Process is deployed. BPEL Process Manager è BPEL Control è Username/password è Dashboard
You will see a process SynchronousHelloWorld.
Click on SynchronousHelloWorld

Input = Sudeept
Choose Post XML Message

You will see the output = Hello World Sudeept

You can understand the whole process by double clicking on each node and looking at the XML at each node

Lets go through each XML Audit to understand the process better.
XML in receiveInput :
input = Sudeept

XML in AssignInputHW :
Input copied into InvokeHelloWorld_process_InputVariable = Sudeept

Value Sudeept copied into HelloWorldProcessRequest and the service called, which returns output Hello World Sudeept.
InvokeHelloWorld_process_OutputVariable = Hello World Sudeept

Value of InvokeHelloWorld_process_OutputVariable (= Hello World Sudeept ) copied to outputVariable.

outputVariable in replyOutput = Hello World Sudeept

Thanks for reading my article.
-- Sudeept Maharana
written by Devesh Mishra , July 08, 2009
Very nice and effective demonstration.Thanks for sharing the documents with us.
Regards
Devesh
written by rakhy , July 29, 2009
its very helpful
written by Gopalb85 , November 05, 2009
written by ramkumar , January 28, 2010
It is very arcticle to understand Bpel process.
regards
Ramkumar






Very Useful article to demonstrate Synchronous processes.
Kishore