In the previous article, we have demonstrated a simple Service Bus project (or OSB module) with only Proxy Service exposed which returns greeting message “hello” to the entered user name
But to leverage the full use of Oracle Service Bus, we need to design Service Bus projects using both Proxy Service & Business Service where
- Business Service interacts with the Enterprise Information Systems or SOA/BPEL modules or any exposed Web Services
- Proxy Service’s message flow helps to validate, enrich and transform the incoming request to required format before routing/operating to Business Service (follows VETRO pattern)
1. Business case requirement :
- User enters ISBN number to retrieve book information
- This will query the database (actually through exposed web service) based on the isbnNumber provided in the request
- Returns book information for valid ISBN number
- Else no book found for entered ISBN number
2. Assumptions :
- There is a exposed web service for Book service up & running on the application server
- This web service can be invoked only through OSB
- For demo purpose, we will copy the WSDL and Schema files and paste in our Service Bus project under “Resources” folder
- For more details about this web service, refer this article
Let’s get started with designing OSB modules in JDeveloper 12c IDE
3. Hello World with Business/Proxy Services :
Every Oracle Service Bus projects should reside under any of the Service Bus Application. In the last article for simple HelloWorldSB project, we have created Service Bus Application.
So we will use same Service Bus Application for this demo
This time instead of starting from “Service Bus Application with Service Bus Project” wizard, we will use same Service Bus Application and directly start creating Service Bus project
Step 1: Open New Project
File Menu –> New –> Project
Step 2: Select Service Bus Tier from available categories
Service Bus Tier –> Service Bus Project –> OK
This opens up wizard for New Service Bus Project
Note: Comparing this wizard with the one we have created in the last article, the major difference is “Service Bus Project” option is enabled since we have one Service Bus Application in the user/developer workspace
Step 3: Enter Project Name and its directory location for the New Service Bus Project
Leave the default values for demo; otherwise we can give more specific names in accordance with naming convention followed in the project
Click Finish
New Service Bus project is created with required artifacts
Step 4: Create required folders in accordance with project standards (naming conventions)
Generally, there should be
- ProxyService folder to place/store/save the proxy services which ends with .proxy
- BusinessService folder to place/store/save the business services which ends with .bix
- Resources folder to store all other required artifacts like WSDL, Schema and transformations files
Now, we will create above listed folders
Right click on the Service Bus project –> New –> Folder…
Opens up a new wizard
Create Folder wizard –> enter folder name like, for example “ProxyService” for Proxy Service
Finally click OK –> to create folder
Similarly, we can create “BusinessService” and “Resources” folders
After creating all three folders namely ProxyService, BusinessService and Resources our project will look like below screenshot
Note: Also create entities & wsdl folders under “Resources” to store Schema and WSDL files
Step 5: Enterprise Information System (EIS) or Exposed Web Services
As we discussed in the assumption section, there is one web service up & running at URL http://localhost:8080/Metro-JAX-WS-Top-Down/services/BookService?wsdl
So we will copy those Schema and WSDL files && paste it to the Resources folder as directed below
- XML Schema –> under “entities” folder
- WSDL –> under “wsdl” folder
Step 6: Create Business Service to invoke the exposed Web Service
Drag and drop HTTP component from Technology palate to External Services lane (Business Service in 11g)
Upon dropping, a new wizard pops up to enter the required details for Business Service or External Service
Step 7: Fill up the mandatory details for Business Service (i.e .bix file)
- Service Name: BookServiceBS (append BS to the business service as a naming standard)
- Location: browse through “BusinessService” folder we created in earlier step
- Transport: http (keep it as it is)
Click Next
Select “WSDL” from four available options
And browse to wsdl location by clicking first icon with green arrow mark pointing towards right hand side (i.e.; wsdl is placed under “Resources/wsdl” folder)
Choose “Application” and select correct WSDL we have stored for this project
Finally click OK and then click Next
In step 2 of Create Business Service wizard –> populates wsdl file with port after reading the WSDL file we have chosen in the previous step
Click Next
In step 3 of Create Business Service wizard –> populates the endpoint URI for the exposed web service to be invoked
Click Finish
Business Service is created on the External Services lane and this resides under “BusinessService” folder
Step 8: Create Proxy Service and add pipeline
Drag and drop HTTP component from Technology palate to Proxy Services
Upon dropping, a new wizard pops up to enter the required details for Proxy Service
Step 9: Fill up the mandatory details for Proxy Service (i.e .proxy file)
- Service Name: BookServicePS (append PS to the proxy service as a naming standard)
- Location: browse through “ProxyService” folder we created in earlier step
- Transport: http (keep it as it is)
Keep “Generate Pipeline” checked for creating pipeline along with Proxy Service
Click Next
We will use the same WSDL for this demo example
In step 2 of Create Proxy Service wizard –> populates wsdl file with port after reading the WSDL file we have chosen in the previous step
Click Next
In step 3 of Create Proxy Service wizard –> populates endpoint URI
Click Finish
Proxy Service is created on the Proxy Services lane and this resides under “ProxyService” folder
Step 20: Connect BookServicePSPipeline with BookServiceBS HTTP service
And double-click on the BookServicePSPipeline which opens up in new editor with .pipeline extension
Step 21: Add transformation logic for the Proxy Service (i.e.; BookServicePSPipeline.pipeline) using assign/replace node
Generally,
- Request document to the input of OSB and request document to the input of Enterprise Service isn’t same at all time
- So, we need to add transformation logic to convert the request document received at the input of OSB to the input of External/Business Service
- Judiciously use assign, replace, rename nodes to transform the request document
- Invoking other services using “Service Callout” or “Java Callout” node to enrich the input request document to the External/Business Service
Note: Above points implies for response thread in the response pipeline of the pipeline-pair
But in our case, we don’t need any transformation logic as both Proxy Service and Business Service are based on the same WSDL
Just pass through the request document to the underlying business service without any real transformation
So with this our design is complete
Time to test !!
Testing the Service Bus project deploying into the IntegratedWeblogicServer
Step 22: Testing
This will open our traditional OSB console, where we can input and execute this sample service. Enter necessary detail in the Request document –> Click Execute
Enter ISBN number as “ISBN-2134”
Request document and Response document
The same can be tested through Service console (OSB console) at http://localhost:7101/sbconsole (change the port number, if you have configured something else)
Related Articles :
- Oracle SOA 12c – Installation steps using Single Installer
- Oracle SOA 12c – Domain creation steps
- Oracle OSB 12c – Hello World mock service with Proxy Service
- Oracle OSB 12c – Hello World service with both Business and Proxy Service
- Oracle OSB 12c – Operational Branch example
- Oracle OSB 12c – Conditional Branch example
- Oracle OSB 12c – Service Callout and Routing Table example
- Oracle OSB 12c – Java Callout and Routing Table example
- Oracle OSB 12c – File Polling/Reading and Writing using File Transport
- Oracle OSB 12c – File Polling/Reading and Writing using FTP Transport and authentication via Service Account
- Oracle WebLogic – Steps to create Connection Factory and Queue
- JMS Client – To produce and consume messages in JMS Queue
- Oracle WebLogic – Steps to create Connection Factory and Topic
References :
Happy Coding !!
Happy Learning !!