Service Callout In OSB

Prerequisite: For understanding this you must have some basic knowledge on SOA as this post involves using SOA to make it more clear to understand.

Well, Service Callout in OSB is similar to Invoke activity in SOA. We use Invoke activity in SOA to trigger external services like (WS Service, DB Service, JMS Service, FTP Service etc). Similarly we use Service Callout in OSB to trigger external services.

Similarities & differences b/w Invoke & Service Callout: Both used to trigger external services, but Invoke can be used for both Synchronous& Asynchronous external services (i.e the calling external service may or may not give the response). But Service Callout is used only to trigger Synchronous external services. To trigger oneway services there is another component in OSB which is ‘Push’ which also works same as Service Callout, only difference is Push is used for triggering Oneway external services and Service Callout is used for triggering Synchronous external services. Invoke activity will be having ‘Input Variable’ and ‘Output variable’ and similarly Service Callout will also has ‘Request Variable’ & ‘Response Variable’.

Let’s take a simple example and discuss about why and where we use Service Callout in OSB. I’ve a an external service asynchronous  service ‘EmployeeInfo’ which accepts EmployeeId, EmployeeName as inputs.

  1. So in OSB first we have to import Resources (WSDL, XSD) for that external WSDL service. Then we have to create Business Service calling the ‘EmployeeInfo’ WSDL.
  2. Create a proxy service based out of Business Service created earlier.
  3. Now we have to pass ‘EmployeeId’, ‘EmployeeName’ as inputs the proxy service which will pass the same as inputs to the business service. But let’s make a requirement like we pass only ‘EmployeeId’ as input to the proxy service then in the Message Flow we have to call another external service ‘EmployeeName’ wsdl, passing ‘EmployeeId’ to get the respective ‘EmployeeName’ and then pass this retrieved ‘EmployeeName’ along with ‘EmployeeId’ to the ‘EmployeeInfo’ wsdl.
  4. So we have to create another Business Service calling ‘EmployeeName’ wsdl.
  5. From the MessageFlow using Service Callout call the ‘EmployeeName’ wsdl. While calling that service pass the ‘EmployeeInfo->EmployeeId’ to the ‘EmployeeName Request variable’ using Assign activity.
  6. Get the response from ‘ EmployeeName Response variable’ and replace it on ‘EmployeeInfo->EmpName’ using Replace activity. This concept is called Message Enrichment.

This is how and why Service Callout is used in OSB. Find below few screnshots for your reference.

The below screen explains about service callout variables (similar to Invoke activity input, output variables)

Note: In all the below screens please assume Customer as Employee.

ServiceCallout

Below screen explains about how we assign ‘EmployeeInfo->EmployeeId’ to ‘EmployeeName request variable’ with the help of Assign.

Assign

Below screen explains about how we replace the EmployeeInfo payload, ‘EmployeeInfoBS->EmployeeName input field’ to ‘EmployeeNameBS response variable’ with the help of Replace.

Replace

To make the above example work we need two SOA services ‘EmployeeInfo’ (Asynchronous) and ‘EmployeeName’ (synchronous) to be created and deployed on server. Which then have to be used in OSB project for creating business services.

Find below screens for SOA BPEL for EmployeeInfo’ (Asynchronous)

EmployeeInfoProcess

Find below screens for SOA BPEL for ‘EmployeeName’ (synchronous).

EmployeeNameProcess

Hope this post helps you to understand concept of Service Callout in OSB.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s