Showing posts with label Operational Branching in OSB 12c. Show all posts
Showing posts with label Operational Branching in OSB 12c. Show all posts

Saturday, July 11, 2020

Operational Branching in OSB 12c

Hi! In this post, I'm going to show you how to create a service bus project where operational branching is used assuming that you're familiar with Proxy Service and Pipeline. If you don't know how to create  a Proxy Service, please check out my previous post HelloWorld in OSB.

The example used in the current post shows an operational branching that consists of four operations - Addition, Subtraction, Multiplication and Division. So lets get started.

1. Create a Service Bus Project.




Give a suitable name and click on Finish.


2. Create folders - BusinessService, ProxyService, Resources. Under Resources folder, Create WSDL and XSD folders as below. You can also create a folder for Pipeline if you want.




Create an xsd file with request as two numbers and response as a result element.




Now, create a WSDL with four operations - Add, Sub, Mul, Div. Usually, we get WSDL files in business requirements. For testing purpose, I created a WSDL as below.





3. Create a Proxy Service with above WSDL. The proxy Service should look something like below.




If you don't get the error in Proxy as above, skip to the next step. If you get the cross mark on Proxy service, double click on the Proxy and click on Operation Selection. Change the Algorithm from 'SOAP Header' to 'SOAP Action Header' as below and save it. Now you won't see any errors on Proxy Service.





4. Edit the Pipeline, Drag and drop an Operational Branch. By default, it would look like below with Add branch that is selected with Add operation.




Add three more sub branches and select the operations Sub, Mul and Div respectively.





Now, insert a Pipeline Pair in the Add branch. Drag and drop a Replace activity into the Response pipeline.





Click on the Replace activity to give required values as below.




Remember to select the Num1 and Num2 elements from Add Operation in the XPath Expression Builder.





Similarly, add pipeline pairs into Sub, Mul and Div branches. Add a replace activity in each response pipeline and give the required values for Replace as we've done in Add branch but the Num1 and Num2 should be selected from their respective operations.

Note: For Division logic, give 'div' instead of '/'.

5. Finally your pipeline should look something like below.




Now, deploy and test your service:)

Featured Posts

Sample Real Time Assignment in Oracle SOA