• No results found

Register Process Order on Service Bus

In document SOASuite12c_Tutorial.pdf (Page 117-138)

Now that you have completed and tested the Process Order composite, you will register it on Service Bus to make it available for external consumers. Service Bus will allow the Process Order composite to be made available over different protocols and data formats without disruption to the core business logic in the composite. Service Bus will also validate the Order data and report for auditing.

For now, you will just create an HTTP / SOAP Proxy and Pipeline for Process Order. You can also add a File Proxy and Pipeline to allow orders to be processed from legacy systems.

View of Service Bus project after Part 2 is complete.

High-Level Steps

Open e2e-1201-servicebus application and import Pipeline template resources (new feature!).

 Configure ProcessOrder Business Service.

 Configure Pipeline and Proxy using Pipeline template.

 Test your application end-to-end.

Steps in Detail

Open existing service bus application and import template resources

Open your e2e-1201-servicebus application from Chapter 2. If already open, then navigate to it.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 118 of 392

Right-click in the Application Navigator window and select Import…

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 119 of 392

On the Import dialog, select Service Bus Resources.

Click OK

Import Service Bus Resources- Step 1 of 3, select Configuration Jar.

Click Next.

Import Service Bus Resources- Step 2 of 3, Click the browse icon to the right of Jar Source.

When the Configuration Jar chooser appears, navigate to where your resources are located on disk and select pipeline-template-resources.jar from the Templates directory.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 120 of 392

Default path ~ /e2e-1201-orderprocessing/templates/pipeline-template-resources.jar.

Click Open

Click Next

Import Service Bus Resources- Step 3 of 3 - Review exactly what is being imported into your application.

Service Bus supports the ability to import and export artifacts and projects at fine-grain level.

You may import artifacts individually, such as a WSDL or schema, or whole projects. You may control whether dependencies are included or not.

By default, when importing individual artifacts, Service Bus will attempt to import all

dependencies declared in the artifact. For example, if a WSDL includes a schema, the schema will also be imported if the paths are relative.

Also note you can control if environmental settings, security policies, and credentials are preserved on import. If you are bringing artifacts from a production environment for testing and editing you may not want all the same policies applied in your development environment for example.

 You will accept all defaults in this case.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 121 of 392

Click Finish.

Your left-hand Application Navigator should now resemble the following:

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 122 of 392

Register ProcessOrder composite as a business service

As you did in Chapter 2, you will first register the composite on Service Bus by creating a Business Service. This time, rather than dragging and dropping from the Component Palette, you will create using a menu-based Insert on the External Services lane.

First, make sure your overview editor is active by double-clicking on the on top or in the left-hand Application Navigator. Your canvas will be blank.

Now, right-click on the External Services lane of the overview editor.

Mouse-over Insert Transports and select HTTP.

This will bring up the same Business Service dialog that you leveraged in Chapter 2. Hopefully these dialogs will be familiar to you now so we will just give you the settings.

Create Business Service – Step 1 of 3:

Service Name: ProcessBS

Oracle Confidential – Do not distribute to third parties

From the WSDL Chooser, select from the Application and then navigate to find WSDL.

ProcessOrderSB->WSDLs->ProcessOrder-concrete.wsdl

Click OK.

Click Next.

Create Business Service – Step 3 of 3:

Service Type: WSDL-based service Transport: Leave as HTTP

Endpoint URI: Leave default

If you need to change the endpoint URI, you could do this from this dialog or wait until later and change under the Business Service -> Transport tab. Service Bus also allows you to have multiple endpoints for your Business Service to support application load-balancing and failover.

Click Finish.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 124 of 392

Before you proceed, why not quickly test your new Business Service and make sure the endpoint is a good one. Do you remember how to do this? One simple way is directly from the overview canvas.

First, click Save All icon.

Right-click ProcessBS icon on the External Services lane and select Run from the menu.

New Concept: What does Run do exactly?

If your Integrated Server is running, your project will be deployed and a window will be displayed, ready for testing.

If your Integrated Server is not running, then it will be started, and then your project will be deployed and a window will be displayed, ready for testing.

If your Integrated Server domain has not yet been created, a dialog will pop-up asking for your

password for the domain and a few other setting, then the domain will be created and started. Finally, your project will be deployed and a window will be displayed, ready for testing..

Not much work on your part!

Once the Test Console is displays, Click on the Browse (Linux) or Choose File button (Windows) and navigate to ~/e2e-1201-orderprocessing/sample_input and select OrderSample.xml.

You can also select the XML tab, and select the OrderSample_soap.xml

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 125 of 392

Select the Execute button.

You should receive a response document that contains an OrderNumber from your ProcessOrder composite. You are ready to build your Pipeline and Proxy!

Create new pipeline with proxy using a pipeline template

Now instead of creating the Pipeline for ProcessOrder from scratch, you will leverage a Pipeline Template. The template encapsulates all the repetitive tasks common with building a Pipeline such as routing, data validation, reporting, error handling and alerting under error conditions.

First, make sure your overview editor is active by double-clicking on the ProcessOrderSB icon on top center or in the left-hand Application Navigator.

Locate the Pipeline icon on the Component palette and drag onto the middle of your canvas.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 126 of 392

The Create Pipeline dialog will appear. This is the same dialog as you used to create your Pipeline in Chapter 2; however, this time you will select to Create the Pipeline from a Template.

Create Pipeline – Step 1 of 2

a. Service Name: ProcessPP

b. Location: Leave as default

c. From Template: Check this box and click on the icon to the right.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 127 of 392

When the Pipeline Template chooser appears, navigate to Application>SharedSB>Templates and select WSDL-VR.ptx.

Naming conventions have not quite emerged for Templates yet; however, this name means it’s a Template for WSDL based services that does validation and routing. It also includes error-handling and alerting but that would get a bit long.

Click OK

Click Next

Create Pipeline – Step 2 of 2

Since this is a WSDL-based template, notice the Service Type is pre-selected as WSDL for you. All you need to do is select the precise WSDL you wish to use for the Pipeline.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 128 of 392

Click on the browse icon to the right of the WSDL option

When the WSDL chooser displays, navigate to

Application>ProcessOrderSB>WSDLs>ProcessOrder-concrete.wsdl

Click OK

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 129 of 392

Check the box for Expose as Proxy Service and set Proxy Name: ProcessPS. Leave rest of the values to their defaults.

Click Finish.

On your canvas you will now see your new Pipeline created from a Template.

The pipeline created still needs some work so it may show an error or a warning (example of an error in the diagram below).

Double-click on the ProcessPP Pipeline and let’s drill down to take a closer look.

This Pipeline looks different than the one we’ve worked with before. Notice that the background is grey. This indicates we are working with a Pipeline derived from a Template. The Template Designer has made some items editable and others not.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 130 of 392

This Pipeline has all kinds of good stuff already built for you – Data Validation, Routing, Error Handling - all you need to do is fill in the blanks. What blanks need to be filled in? Notice the

flags – these indicate areas that still need to be filled in to have a valid Pipeline. Service Bus has strong design-time validation so it will help you keep track when the Pipeline has been

completely filled out.

Notice the ‘Your Request Stages’. This is where the Template Designer has left a placeholder for you to customize the Pipeline to do any additional work like transformations, message enrichment before the data Validation action will be performed, likewise on the Response Pipeline.

Also, notice the Error Handler at the top right. Best practice is to always have an Error Handler defined for Pipelines. This pre-defined Error Handler will report the error back to the caller with good details and also send up an Alert to the EM console that something is wrong with processing.

Likely we may have invalid Order data incoming.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 131 of 392

Before editing the derived Pipeline, select the Configuration tab at the bottom of the canvas.

Review the instructions given by the Template Designer in the Description area before proceeding.

This is where documentation of how to use the Template should be captured and shared by the Template Designer to the Developer using the template.

Re-select the Design tab, and let’s now fill in the template and complete our Pipeline.

First, let’s get rid of those flags.

Double-click on the Validation action to open the Property Editor.

NOTE: If the Property inspector is not visible you can make it appear by going to the menu and selecting Windows->Properties. The window should appear, usually in the right bottom corner.

Move to the bottom center of your screen for easiest access.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 132 of 392

Open the Data Validation stage and select the Validate action. You will validate the incoming payload against the canonical Order element type that the ProcessOrder composite is expecting. By validating in Service Bus, you save precious resources in the backend that are actually processing good orders.

We only need to fill in the type to validate against. The location has already been provided by the Template Designer. Since this is a WSDL based service, Service Bus knows our data types and can help us easily fill in the blanks.

In the Properties tab – see Schema, select Static

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 133 of 392

Click on the magnifying glass on the right to bring up the XML Schema/WSDL chooser.

Navigate to Application>Schema>CanonicalOrder.xsd>Order OrderType

Click OK

Notice the red flag is gone! Notice the different Actions you can take when you Validate.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 134 of 392

You may raise an error (default) or simply assign the value to a variable that you can check in your Pipeline. Perhaps you have a service that fixes common data entry type mistakes.

New Feature: Dynamic validation is supported in this release, so you can determine at runtime the schema type to check based on an expression.

Move to the Reporting action in the Auditing stage of the response flow. Let’s customize to report on the Order number that is returned from our composite. The template already saves a copy of the incoming Order in case of an error and reports it to EM.

In the Property tab, select the Report finger tab.

Click on the Key: OrderNo Variable: Select body

XPath: Click on the little icon to the right to pop-up the expression editor.

XPath Expression Builder, navigate to Variables tab in the middle of the screen and navigate to Body>process>$ body –response > OrderAck > OrderNumber

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 135 of 392

Drag this element to the top box and click OK.

Click OK. You are almost DONE.

Double-click the Routing node and select the Route finger tab in the Property inspector.

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 136 of 392

Click on the magnifying glass on the right and navigate to the ProcessBS Business Service.

Click OK

Oracle Confidential – Do not distribute to third parties

Chapter 3: Process Order: Register on Service Bus Page 137 of 392

We are ready to test. Click on the Application Navigator project icon to refresh your overview. It should now resemble the following:

Test end-to-end

Click on the ProcessPS service on the left swim lane and select Run

First, send in a good Order

a. ~/e2e-1201-orderprocessing/sample_input/OrderSample.xml

Then send in and invalid order

a. ~/e2e-1201-orderprocessing/sample_input/BadOrderSample.xml

What happens? Are the results sent back to you enough to understand what the problem is?

Did Templates make building your Pipeline easier?

Oracle Confidential – Do not distribute to third parties

In document SOASuite12c_Tutorial.pdf (Page 117-138)