Before You Begin
Purpose
This Oracle by Example (OBE) tutorial shows you how to develop an Oracle Service Bus application consuming a virtualized service in Oracle SOA Suite 12c.
Time to Complete
45 minutes
Background
Oracle Service Bus is a configuration-based, policy-driven enterprise service bus designed for SOA lifecycle management. 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.
Virtualizing a service in Oracle Service Bus protects consumers of composite applications from the effects of routine changes in deployment location and implementation updates.
Oracle Service Bus provides a virtualization layer to support Representational State Transfer(REST) web services, which means that only proxy and business services are REST-based.
Context
This is the fourth OBE of a series that shows you how to install Oracle SOA Suite 12c, develop and test SOA composite and Oracle Service Bus applications from the start, and deploy the same applications to Oracle SOA Suite Cloud Service.
What Do You Need?
- Oracle SOA Suite Quick Start for Developers
- Basic knowledge of Oracle JDeveloper
- Oracle WebLogic Server started on your system
- The HelloWorld composite application deployed in Oracle WebLogic Server
Creating an Oracle Service Bus Application
-
Open Oracle JDeveloper 12c, click the Applications tab, and select New Application.
Note: If you already have applications open, then from the main menu, click File, then New, and then New Application.
-
On the New Gallery page, select Service Bus Application with Service Bus Project and click OK.
-
On the Create Service Bus Application with Service Bus Project - Step 1 of 2 page, in the Application Name field enter
ServiceBusDemo
and click Next. -
On the Create Service Bus Application with Service Bus Project - Step 2 of 2 page, in the Project Name field enter
SayHelloSB
. From the Project Features panel, select Service Bus and click Finish.Wait until the application creation and configuration are complete.
On the Applications tab, you can examine the created ServiceBusDemo application files.
Note: If the Service Bus Sources directory doesn't appear, verify that you are using the Application View.
Defining a Directory Structure and Importing Artifacts
After you've created the Service Bus application and project, you define a directory structure and import artifacts like Web Services Definition Language (WSDL) and XML Schema Definition (XSD) files:
Define a WSDL Directory
-
On the Applications tab, right-click the Service Bus Sources directory, select New and then From Gallery.
The New Gallery page appears.
-
On the New Gallery page, select Folder and click OK.
-
On the Create Folder page, in the Folder Name field enter
WSDLs
and click OK.
Import Artifacts
-
On the Applications tab, right-click the WSDLs directory and select Import.
The Import page appears.
-
On the Import page, select Service Bus Resources and click OK.
-
On the Import Service Bus Resources - Step 1 of 3 page, select Resources from URL and click Next.
-
On the Import Service Bus Resources - Step 2 of 3 page, click the Browse icon of the Source URL field.
The Select page appears.
-
On the Select WSDL page, click Application Server. Expand DefaultServer, default, and SayHello[Default 1.0], select makegreeting_client_ep(ws) and click OK. Make sure to avoid the https URL; if it's selected by default, then change it to http using the port 7101.
Note: Oracle WebLogic Server must be started and the SayHello composite application has to be deployed before reaching this step.
-
On the Import Service Bus Resources - Step 2 of 3 page, accept the default values and click Next.
-
On the Import Service Bus Resources - Step 3 of 3 page, accept the default values and click Finish.
Adding Service Bus Components
After you've created the Service Bus application and project, you add the Service Bus components to consume a virtualized service:
Create a Business Service
-
On the Applications tab, double-click SayHelloSB.
-
On the SayHelloSB page, drag and drop an HTTP adapter component from the Components panel to the External Services swimlane(column).
The Create Business Service page appears.
-
On the Create Business Service - Step 1 of 3 page, in the Service Name field enter
SayHelloService
and click Next. -
On the Create Business Service - Step 2 of 3 page, select WSDL and click the Browse WSDLs icon.
The Select WSDL page appears.
-
On the Select WSDL page, click Application. Expand SayHelloSB and WSDLs, select makegreeting_client_ep.wsdl and then click OK.
-
On the Create Business Service - Step 2 of 3 page, accept the default values and click Next.
-
On the Create Business Service - Step 3 of 3 page, accept the default values and click Finish.
Add a Pipeline
-
On the SayHelloSB page, drag and drop the arrow from the left side of the SayHelloService component to the Pipelines/Split Joins swimlane (column).
-
On the Create Pipeline Service - Step 1 of 2 page, in the Service Name field enter
SayHelloPipeline
and click Next. -
On the Create Pipeline Service - Step 2 of 2 page, accept the default values and click Finish.
Verify that the SayHelloSB page contains the wired (connected) components:
Exposing a REST Service
In this section, you expose the existing Simple Object Access Protocol (SOAP) service as a REST service.
-
On the SayHelloSB page, right-click SayHelloPipeline and select Expose As REST.
-
On the Create REST binding page, in the Name field enter
SayHelloREST
, and select the resource path element. Under the Operation Bindings panel, select process, and click the Edit and operation binding icons. -
On the REST Operation Binding page, enter a Description. On the Request tab, under the URI Parameters panel, rename the parameter input to
your_name.
-
On the REST Operation Binding page, click the Response tab, select JSON and unselect XML, then click OK.
-
On the Create REST binding page, click OK.
-
Verify that your SayHelloSB page is updated with the SayHelloREST proxy service:
Testing Services in the Local Environment
After you've added the Service Bus components, you test the SOAP and REST Proxy Services:
Test a Proxy Service
-
On the SayHelloSB page, right-click the SayHelloPipelineProxyService and select Run.
The Oracle Service Bus Console 12c page appears.
Note: If you forgot to start Oracle WebLogic Server, then this action starts the server automatically.
-
On the Form tab, replace the string from the XML payload with your name and click Execute.
-
In the Oracle Service Bus Console 12c page, scroll down to the Response Document panel and verify that the result contains your name.
Test a REST Service
-
On the SayHelloSB page, right-click SayHelloREST and select Run.
The Oracle Service Bus Console 12c page appears.
-
On the Request Document panel, enter your name and click Execute.
-
On the Oracle Service Bus Console 12c page, scroll down to the Response Document panel and verify that the result contains your name.
The Response Document displays the response in JSON format.
Want to Learn More?
- Performing a Quick Start Installation of Oracle SOA Suite 12c
-
In the Oracle Help Center: Creating Service Bus Applications and Projects in JDeveloper
-
In the Oracle Help Center: Developing Oracle Service Bus Applications in JDeveloper
-
In the Oracle Learning Library: REST-Enabling SOA
Credits
-
Lead Curriculum Developer: Armando Hernandez