Sunday 15 October 2017

Oracle Service Bus Introduction

Oracle Service Bus Introduction

Oracle Service Bus (previously known as Weblogic ALSB) is a light weight messaging component of SOA Suite. In addition to providing basic routing and transformation services, OSB also provides advanced capabilities for service abstraction.
As of version 11.1.1.3, OSB can only run on Weblogic platform. Since it runs in a separate JVM, there is an overhead in communicating with rest of SOA Suite components.
Though OSB is similar to Mediator component at the conceptual level, there are specific scenarios when OSB is very useful.
OSB has a built-in feature to modify service end point at the run time. This would be very useful when virtualizing external services, probably hosted by various partners.
OSB can also be used to throttle services, thus limiting the number of invocations. This can be valuable in meeting client service level agreements as well as preventing services from being swamped.
In other cases, Mediator will offer more benefits since it is available in the same JVM as rest of SCA components.

OSB service invocation overview

oracle soa tutorials
OSB service invocation happens through two different layers: proxy service and business service. Proxy service is an entry point for all service invocations. Ideally, proxy service should present canonical interfaces to clients.
Proxy service then routes an inbound message through a series of steps (aka pipes). Each step can perform distinct operations such as transformation, enrichment, and logging, etc. Eventually this message is routed to Business Service which is just a reference to target service. Similarly, output message from business services follows reverse flow through an outbound pipeline, proxy service and finally to the client.
Input and output pipe lines are also responsible for transforming data from and to a canonical format.
In subsequent lessons, we will explore various features of OSB.

OSB Sample Application

In this lesson, we are going to create our first Hello World OSB service. This requires us to create a Business Service, a Proxy Service and import an External Service we created earlier using BPEL.
Installed Hello World BPEL process is a pre-requisite for this lesson. Also, please see Introduction to OSB for an overview of the product.
Login to OSB console using the URL http://localhost:7001/sbconsole. This URL may change based on your server’s hostname and port number.
oracle soa tutorials
Click on “Create” under Change Center to create an exclusive session for our Helloworld project. This ensures that resulting changes are not in conflict with other users’ work.
oracle soa tutorials
Create a project to hold XML artefacts and WSDLs. Click on Project Explorer at the bottom left side of the console. Enter “helloworld” as the project name.
oracle soa tutorials
Click on helloworld project to get to the project details page.
oracle soa tutorials
oracle soa tutorials
Create three folders to hold Business Service, Proxy Service, and External Service resources: BusinessService, ProxyService, and ExtService respectively.
oracle soa tutorials
oracle soa tutorials
Create External Service
Lets import WSDL required to invoke HelloWorld external service. Click on ExtService folder link. From Create Resource drop down, select “Resource from URL” option.
oracle soa tutorials
Get Hello World BPEL process’s WSDL from EM Console.
oracle soa tutorials
Copy Hello World BPEL Process’s WSDL URL for URL/Path field. Enter other field values as shown below. Click on Next.
oracle soa tutorials
From Load Resources page, we can see that OSB has imported WSDL as well as referenced XSD file. Click on Import button.
oracle soa tutorials
Import confirmation is shown in the next screen.
oracle soa tutorials
Create Business Service
Click on BusinessService folder link from Project Explorer on the left side to go back to project folder.
Let us create a Business Service using the imported resources. From Create Resource menu, select Business Service.
oracle soa tutorials
Enter HelloWorldBS for Service Name.
oracle soa tutorials
Click on Browse next to WSDL Web Service to open up WSDL we added in previous steps. Click on HelloWorldBPEL WSDDL link.
oracle soa tutorials
Select HelloWorldProcess_pt port type and click on Submit.
oracle soa tutorials
oracle soa tutorials
Click on Next to go to Transport Configuration page. We can leave the default values. Click on Last button to go to summary page. Click on Save to complete creation of Business Service.
oracle soa tutorials
From Resource section, we can see that HelloWorldBS business service is successfully created.
oracle soa tutorials
Create Proxy Service
Click on ProxyService folder link from Project Explorer. Under Resources section, select Proxy Service from Create Resource combo box.
oracle soa tutorials
Enter values as shown below.
oracle soa tutorials
Select Business Service and click on Browse button to see the list of available business services. Select HelloWorldBS from the list and click on Submit.
oracle soa tutorials
oracle soa tutorials
Click on Last and then Save from summary page to create Proxy Service. We can see HelloWorld proxy service successfully created from Project details page.
oracle soa tutorials
Create Message Flow
Since Proxy Service is created based on an existing Business Service, the request is already configured to be routed from proxy service to business service. Let us verify this. Click on Edit Message Flow icon from Actions section.
oracle soa tutorials
From Edit Message Flow window, we can see the message flow is already established. Click on Cancel to go back to project details page.
oracle soa tutorials
Let us save our work. Click on Activate button from Change Center. Click on Submit button.
oracle soa tutorials
Testing Proxy Service
Click on ProxyService folder link from Project Explorer.
oracle soa tutorials
Click on Launch Test Console action as shown below.
oracle soa tutorials
Leave the default values for all fields except for Payload. Enter orafmwschool as input element value. Click on Execute.
oracle soa tutorials
We can see the request and response  XML documents. Observe response document contains “Hello orafmwschool” as the result element value.
oracle soa tutorials

No comments:

Post a Comment