OSB 12c - HelloWorld

Here we go!
Information that you need to know:

Oracle Service Bus is a configuration-based, policy-driven enterprise service bus designed for SOA life cycle management. It provides foundation capabilities for service discovery and intermediation, rapid service provisioning and deployment, and governance. Service Bus provides scalable and reliable service-oriented integration, service management, and traditional message brokering across heterogeneous environments. It combines intelligent message brokering with routing and transformation of messages, along with service monitoring and administration. Service Bus leverages industry standards to connect services and support a high level of heterogeneity, connecting your existing middleware, applications, and data sources, and protecting existing investments. For more detailed information read the following URL: https://docs.oracle.com/middleware/1221/osb/docs.htm

In this post, we will learn how create our first OSB Project.

We need to start the JDeveloper IDE.

Click on File menu, then click on New option, followed immediately by Application option.

For example:

Then on the New Gallery window, choose Applications option in General Category, then choose Service Bus Application item.

For example:

On the Application window, set the next values, and click on finish button.
Application Name  TrainingOSB
Directory  C:\JDeveloper\mywork\Training\TrainingOSB
Application Package Prefix 

For example:

Click on File menu, then click on New option, followed immediately by Project option.

For example:

Then on the New Gallery window, choose Projects option in General Category, then choose Service Bus Project item.

For example:

On the Project window, set the next values, and click on next button.
Project Name  helloWorld
Directory  C:\JDeveloper\mywork\Training\TrainingOSB\helloWorld

For example:

After clicking on finish button, the JDeveloper IDE has the next appearance:

Then the next step, we need go to helloWorld directory and create the following folders (required in accordance with project standards (naming conventions)):

  • BusinessServices
  • ProxyServices
  • WSDLs
  • Schemas
  • Transformations
--> 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
--> WSDLs folder to store all required artifacts WSDL type
--> Schemas folder to store all required artifacts Schema type
--> Transformations folder to store all required artifacts Transformation type

For example:

Click on Refresh icon, then select Refresh Application, now we are going to view the folders that we created in the previous step.

For example:

We are going to create the XML schema, so for this we need to select the Schemas folder and right-click, then in the options of the pop-up list we must select New -> XML Schema...

Note: An XML Schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD).

On Create XML Schema window, we need put the following values:

File Name  helloWorld
Directory  C:\JDeveloper\mywork\Training\TrainingOSB\helloWorld\Schemas
Target Namespace   
Prefix   

For example:

We need to update the XSD file with only two elements, these are process and processResponse both are string type.

For example:
Design
Source

The next step create a contract –> we will create new WSDL for contract with single input and single output for returning a greeting message with "Hello welcome to OSB 12c world", so for this we need to select the WSDLs folder and right-click, then in the options of the pop-up list we must select New -> WSDL (builder)...

For the Interface Type, choose "Synchronous Interface" from two options available –> which will enable the input, output and fault elements to be entered for inputs, outputs and faults respectively.

Basically the information entered in the Create WSDL window should be the following:

File Name  helloWorld.wsdl
Directory  C:\JDeveloper\mywork\Training\TrainingOSB\helloWorld\WSDLs
Namespace  http://xmlns.oracle.com/TrainingOSB/helloWorld/helloWorld
Binding  execute_bind
Binding Type  SOAP 1.1
Create Port Type  Selected
Port Type  execute_ptt
Operation  execute
Interface Type  Synchronous Interface
Input  Message Part Name: request
Output  Message Part Name: response
Fault   

Note: Click green plus icon to add the required elements for input, output and fault (on right-top-corner).

Click OK.

The WSDL have the following design.


Note: It may be of your interest, read about from SOAP 1.1 to SOAP 1.2 in the following URL: https://www.w3.org/2003/06/soap11-soap12

Then the next step, we need to create the Pipeline service, to do we need select the Pipeline component, this component is located on the right side, on Components section, when you found this, select it and drag it to Pipelines/Split Joins section on work area (canvas).

FOR YOUR INFORMATION: Pipelines define message routing and transformation logic, as well as message handling options. This logic includes activities such as transformation, publishing, logging, reporting, alerts, and exception management. Each of these activities are configured as individual actions within the message flow.

The following primary elements are used to construct a pipeline:

  • A start node.
  • A pipeline pair, one for the request and one for the response. Each pipeline in a pair consists of a sequence of stages that specify actions to perform during request or response processing.
  • A branch node, to branch based on the values in designated parts of the message or message context, or to branch based on the operation invoked.
  • A route node, to define the message destination. The default route node is an echo node that reflects the request as the response.
  • An error handler, which can be attached to any node or stage to handle potential errors at that location.

Then on Create Pipeline Service - Step 1 of 2, we are going to fill the fields according to the following table.

Service Name  helloWorldPipeline
Location  C:\JDeveloper\mywork\Training\TrainingOSB\helloWorld\ProxyServices
Description   
From Template  Unchecked

For example:

Then on Create Pipeline Service - Step 2 of 2, we are going to fill the fields according to the following table.

WSDL  helloWorld/WSDLs/helloWorld
Binding  execute_bind
Expose as a Proxy Service  Checked
Proxy Name  helloWorldPipelineProxyService
Proxy Location  C:\JDeveloper\mywork\Training\TrainingOSB\helloWorld\ProxyServices
Proxy Transport  http

Basically we are going to select the WSDL that we created previously, and check the Expose as a Proxy Service field.

For example:

FOR YOUR INFORMATION: Proxy services are Service Bus definitions of generic intermediary web services that are hosted locally on Service Bus. A proxy service communicates with external services through interfaces, which may or may not be identical to that of a service provider or service consumer business service. Through pipelines, you can route messages from a proxy service to multiple business services using their configured independent interfaces.

Once completed the previous steps, your JDeveloper should be the following appearance.

We are going to do double click on the helloWorldPipeline component, right after, the helloWorldPipeline.pipeline will open, as you can see in the following image.

Then we are going to locate the Pipeline Pair component, select it and drag it to the start node (below the helloWorldPipeline service), having as a result the following appearance:

We are going to change the names of Stages, use the following table for your reference.

Stage1 (Request Pipeline -> RequestStage
Stage1 (Response Pipeline -> ResponseStage

For example:

Then we are going to locate the Assign component, select it and drag it to ResponseStage node.

For example:

Now we are going to update the Assign component, filling the Value and Variable fields, using as a reference the following table.

Value  {"Hello welcome to OSB 12c world"}
Variable  body

For example:

Now the next step is create a jar configuration file to can deploy it on OSB Console, we need to select the helloWorld project and right click, then chose the Export... option.

For example:

On the Export window, select the next values, and click on OK button.
Select What You Want to Export -->  Service Bus Resource

For example:

On the Export Service Bus Resource - Step 1 - 2 window, set the next values, and click on Next button.
Select the destination to export to -->  Configuration Jar

For example:


On the Export Service Bus Resource - Step 2 - 2 window, set the next values, and click on Finish button.
Export Level  project
Jar File  Your Export Destination

For example:


If all steps were successful, then your jar configuration file should be created in your export destination path.
For example:

Once created the jar configuration file, we need access to Oracle Service Bus Console.
For example:

Click on Create button to create a new session.
For example:

Now we have to click on Import Config Jar, in the Designer option.
For example:

Then Import Config Jar pop-up window is show.
For example:

On Import Config Jar pop-up window we are going to do click on Browse... and select the jar configuration file created previously, then click on next icon.
For example:

Then all the resources related to your project should be displayed in the same Import Config Jar pop-up window, let's keep the same values, and click on Import button.
For example:

Then in the same Import Config Jar pop-up window we will see the "resource(s) have been imported with no issues" message, then click on Close button.
For example:

To end the session and deploy the configuration to the runtime, click Activate in the top right corner of the Oracle Service Bus Console window.
For example:

Comments

Popular posts from this blog

SOA 12c - Fault Handling (Creating Fault Policies and Fault Bindings)

SOA 12c - DB Adapter (Poll for New or Changed Records in a Table)

SOA 12c - DB Adapter (Perform an Operation on a Table)