Creating an Oracle Service Bus Application with Oracle JDeveloper 12c


Options



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?

Creating an Oracle Service Bus Application

  1. Open Oracle JDeveloper 12c, click the Applications tab, and select New Application.

    Description of this image

    Note: If you already have applications open, then from the main menu, click File, then New, and then New Application.

  2. On the New Gallery page, select Service Bus Application with Service Bus Project and click OK.

    Description of this image
  3. 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.

    Description of this image
  4. 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.

    Description of this image

    Wait until the application creation and configuration are complete.

    On the Applications tab, you can examine the created ServiceBusDemo application files.

    Description of this image

    Note: If the Service Bus Sources directory doesn't appear, verify that you are using the Application View.

    Description of this image

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

  1. On the Applications tab, right-click the Service Bus Sources directory, select New and then From Gallery.

    Description of this image

    The New Gallery page appears.

  2. On the New Gallery page, select Folder and click OK.

    Description of this image
  3. On the Create Folder page, in the Folder Name field enter WSDLs and click OK.

    Description of this image

Import Artifacts

  1. On the Applications tab, right-click the WSDLs directory and select Import.

    Description of this image

    The Import page appears.

  2. On the Import page, select Service Bus Resources and click OK.

    Description of this image
  3. On the Import Service Bus Resources - Step 1 of 3 page, select Resources from URL and click Next.

    Description of this image
  4. On the Import Service Bus Resources - Step 2 of 3 page, click the Browse icon of the Source URL field.

    Description of this image

    The Select page appears.

  5. 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.

    Description of this image

    Note: Oracle WebLogic Server must be started and the SayHello composite application has to be deployed before reaching this step. 

  6. On the Import Service Bus Resources - Step 2 of 3 page, accept the default values and click Next.

    Description of this image
  7. On the Import Service Bus Resources - Step 3 of 3 page, accept the default values and click Finish.

    Description of this image

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

  1. On the Applications tab, double-click SayHelloSB.

  2. On the SayHelloSB page, drag and drop an HTTP adapter component from the Components panel to the External Services swimlane(column).

    Description of this image

    The Create Business Service page appears.

  3. On the Create Business Service - Step 1 of 3 page, in the Service Name field enter SayHelloService and click Next.

    Description of this image
  4. On the Create Business Service - Step 2 of 3 page, select WSDL and click the Browse WSDLs icon.

    Description of this image

    The Select WSDL page appears.

  5. On the Select WSDL page, click Application. Expand SayHelloSB and WSDLs, select makegreeting_client_ep.wsdl and then click OK.

    Description of this image
  6. On the Create Business Service - Step 2 of 3 page, accept the default values and click Next.

    Description of this image
  7. On the Create Business Service - Step 3 of 3 page, accept the default values and click Finish.

    Description of this image

Add a Pipeline

  1. On the SayHelloSB page, drag and drop the arrow from the left side of the SayHelloService component to the Pipelines/Split Joins swimlane (column).

    Description of this image
  2. On the Create Pipeline Service - Step 1 of 2 page, in the Service Name field enter SayHelloPipeline and click Next.

    Description of this image
  3. On the Create Pipeline Service - Step 2 of 2 page, accept the default values and click Finish.

    Description of this image

    Verify that the SayHelloSB page contains the wired (connected) components:

    Description of this image

Exposing a REST Service

In this section, you expose the existing Simple Object Access Protocol (SOAP) service as a REST service.

  1. On the SayHelloSB page, right-click SayHelloPipeline and select Expose As REST.

    Description of this image
  2. 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.

    Description of this image
  3. 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.

    Description of this image
  4. On the REST Operation Binding page, click the Response tab, select JSON and unselect XML, then click OK. 

    Description of this image
  5. On the Create REST binding page, click OK.

    Description of this image
  6. Verify that your SayHelloSB page is updated with the SayHelloREST proxy service:

    Description of this image

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

  1. On the SayHelloSB page, right-click the SayHelloPipelineProxyService and select Run.

    Description of this image

    The Oracle Service Bus Console 12c page appears.

    Note: If you forgot to start Oracle WebLogic Server, then this action starts the server automatically.

  2. On the Form tab, replace the string from the XML payload with your name and click Execute.

    Description of this image
  3. In the Oracle Service Bus Console 12c page, scroll down to the Response Document panel and verify that the result contains your name.

    Description of this image

Test a REST Service

  1. On the SayHelloSB page, right-click SayHelloREST and select Run.

    Description of this image

    The Oracle Service Bus Console 12c page appears.

  2. On the Request Document panel, enter your name and click Execute.

    Description of this image
  3. On the Oracle Service Bus Console 12c page, scroll down to the Response Document panel and verify that the result contains your name.

    Description of this image
  4. The Response Document displays the response in JSON format.

Want to Learn More?

Credits

  • Lead Curriculum Developer: Armando Hernandez