SOA 11g Tutorial: Virtualize Services with OSB

 

This is part of the Oracle SOA11g hands on tutorials.

Create OSB Project

Login OSB web console

* Login OSB web console per OSB installation type. In this case, SOA domain was extended to support OSB, so the console URL is: http://localhost:7001/sbconsole

Create a New Session

* On Change Center (upper left)
– Click Create button to start a new session.
* Click Change Center -> Create button to create a new session.

Import Resources

* Click System Administration on the bottom of left hand side panel.
* Click Import Resources.
– Browse to C:\po\solutions\ch11-OSB\Lab 11 OSB starting sbconfig.jar
– Click Next.
– Click Import.

Save Changes

* Click Activate button on Change Center panel.
* Enter
– Description: Import OSB project resource..
* Click Submit.

Create Business Service

Create a New Session

* On Change Center (upper left)
– Click Create button to start a new session.
* Click Change Center -> Create button to create a new session.

Create Project Folders

* Click Project Explorer on the left side panel.
* Click Projects link.
* Click Credit Services under Projects link
* Add ProxyServices folder on the right hand side pane.
– New Folder Name: ProxyServices.
– Click Add Folder.
* Add Resources folder on the right hand side pane.
– New Folder Name: Resources.
– Click Add Folder.

Import WSDL Resources from URL

* Click Resources link on the left panel.
* On the Create Resource drop down list
– Select Bulk -> Resources from URL
* On Load Resources page,
URL/Path: http://localhost:8001/soa-infra/services/default/validationForCC/getStatusByCC?WSDL
(URL can be found from EM under SOA -> soa-infra -> default -> validationForCC[1.0])
Resource Name: ValidateCredit_WSDL
Resource Type: WSDL
– Click Next.
– Click Import.

Create validatorForCC Business Service

* Click Project Explorer on the left side panel.
* Click Projects -> Credit Services -> BusinessServiceslink.
* On the Create Resource drop down list,
– Select Service -> Business Service
* On General Configuration page,
– Service Name: validatorForCC
– Service Type: WSDL Web Service
– Click Browse… button to bring up SElect a WSDL Definition page.
~ Click ValidateCredit_WSDL.
~ Click execute_pt.
~ Click Submit button.
– Click Next buttons.
– Click Save.

Enable Monitoring

* Back on Credit Services -> BusinessServices page.
* Click validateForCC in the Resources pane.
– Click Operational Settings tab.
– Enable Monitoring by checking Enabled check box.
– Set aggregation Interval to 25 mins.
– Click Update button.

Save Changes

* Click Activate button on Change Center panel.
* Enter
– Description: Add new business service for validatorForCC.
* Click Submit.

Test Business Service

* Back on Credit Services -> BusinessServices page.
* Click the “Launce Test Console” debug icon to the right of validatorForCC in the Resources panel.
* Enter payload message

<cca:creditcardStatusRequest xmlns:cca="http://www.globalcompany.com/ns/CCAuthorizationService">
    <cca:CCNumber>1234-1234-1234-1234</cca:CCNumber>
</cca:creditcardStatusRequest>

* Click Execute button.
* Review that Response Document returns VALID for th ecreditcardStatus field

<inp1:creditcardStatus xmlns:inp1="http://www.globalcompany.com/ns/CCAuthorizationService">VALID</inp1:creditcardStatus>

Create a Proxy Service

Create a New Session

* On Change Center (upper left)
– Click Create button to start a new session.

Create New Proxy Service

* Click Projects -> ProxyServices in the Project Explorer pane.
* On Create Resource drop down list, select Proxy Service.
* Enter
– Service Name: ValidateCredit
– Description: Validate credit card web service.
– Service Type: WSDL Web Service
* Browse and select ValidateCredit_WSDL
– Select execute_pt
– Click Submit
* Click Next
– Protocol: http
– Endpoint URI: /Credit_Services/ProxyServices/ValidateCredit
* Click Next buttons until summary page.
* Click Save.

Setup Proxy Service Route

* Back on ProxyServices page.
* Click on the Edit Message Flow icon to the right of newly created ValidateCredit proxy service to bring up the Edit Message Flow page.
* Click Edit button on the bottom of the page if the flow already exist.
* Click on ValidateCredit icon.
– Select Add Route.
* Click on RouteNode1 icon.
– Select Edit Name and Comments.
– Set Name to: RouteTo_validationForCC
– Click Save.
* Click on RouteTo_validationForCC.
– Select Edit Route.
* Click Add an Action.
– Select Communication -> Routing.
* Click on Service link
– Select validatorForCC.
– Click Submit.
* Select Use Inbound operation for outbound.
* Click Save All button.

Save Session

* Click Activate button in Change Center panel.
* Enter
Description: Add ValidateCredit proxy service.
* Click Submit.

Test

* Click ProxyServices in the Project Explorer pane.
* Click the Launch Test Console debug icon to the right of ValidateCredit proxy service.
* Enter payload message

<cca:creditcardStatusRequest xmlns:cca="http://www.globalcompany.com/ns/CCAuthorizationService">
    <cca:CCNumber>1234-1234-1234-1234</cca:CCNumber>
</cca:creditcardStatusRequest>

* Click Execute button.
* Review that Response Document returns VALID for the creditcardStatus field

<inp1:creditcardStatus xmlns:inp1="http://www.globalcompany.com/ns/CCAuthorizationService">VALID</inp1:creditcardStatus>

Configure Message Flow

Start a New Session

* On Change Center (upper left)
– Click Create button to start a new session.

Add Pipeline Pair

* Click Projects -> Credit Services -> ProxyServices in project Explorer panel.
* Click the Edit Message Flow icon to the right of the ValidateCredit proxy service to bring up the Edit Message Flow editor.
* Click ValidateCredit icon
– Select Add Pipeline Pair.

Add Report Stage

* Click Request_Pipeline.
– Select Add Stage.
* Click on the new Stage1 icon.
– Select Edit Stage.
* Click Add Action -> Reporting -> Report.
* Click Expression and
– enter XQuery Text: $body
– Click Save.
* Click Add a Key link and enter:
– Key Name: CCNumber
* Under Key Value, click XPath and enter:
./cca:creditcardStatusRequest
– Click Save.
* Under Key Value, enter
– in variable: body
* Click Save.

Add Validate Stage

* Click Request_Pipeline.
– Select Add Stage.
* Click on the new Stage2 icon.
– Select Edit Stage.
* Click Add Action -> Message Processing -> Validate.
* Click XPath and enter:
./*
– Click Save.
* Enter in variable field:
– in variable: body
* Click Resource after the word “against”.
* Click Schema to bring up the Select a XML Schema page.
– Click XMLSchema_ with path value of “Credit Services/Resources”.
– Click creditcardStatusRequest
– Click Submit.
* Check Raise Error on validation failure.
* Click Save button.

Add Alert Destination

* Click Projects -> Credit Services -> Resources.
* Click Create Resource drop down list.
– Select Utility -> Alert Destination.
* Enter
Resource Name: InvalidCreditAlertDestination
Resource Description: Invalid credit alert destination.
* Click Save.

Add Error Handler

* Click ValidateCredit icon.
– Select Add Server Error Handler.
* Click on Error Handler icon.
– Select Add Stage.
* Click on newly added stage1 icon.
– Select Edit Stage.
* Click Add an Action -> Reporting -> Alert.
* Click Destination link,
– Select: InvalidCreditAlertDestination
– Click Submit button.
* Click Expression link and enter:
– XQuery Text: $body
– Click Save button.
* Enter:
– and alert-summary: Credit validation error
– at severity level: Critical
* Click Save three times.

Save Session

* Click Activate button in Change Center panel.
* Enter
Description: Configure ValidateCredit proxy service message flow.
* Click Submit.

Wire POProcessing App to use Proxy Service

Find Proxy Service Endpoint URI

* Click Projects -> Credit Services -> ProxyServices in Project Explorer pane.
* Click ValidateCredit proxy service in Resources pane
* Find Endpoint URI:

/Credit_Services/ProxyServices/ValidateCredit

Find osb_server1 listen port

– Login WebLogic Server Admin Console
– Click soa_domain -> Environment -> Servers in the Domain Structure pane
– Find osb_server1 Listen Port, e.g. 8011.
* So ValidateCredit proxy service URL is:
http://localhost:8011/Credit_Services/ProxyServices/ValidateCredit?WSDL

Change Composite Application to use Proxy Service

* Open POProcessing composite.xml file
* Right click getCreditCardStatus partner link to bring up the Update Reference dialog.
* Change the WSDL URL
from
http://localhost:8001/soa-infra/services/default/validationForCC!1.0/getStatusByCC.wsdl
to
http://localhost:8011/Credit_Services/ProxyServices/ValidateCredit?WSDL
* Click OK.
* Save All.

Redeploy

* Redeploy POProcessing application.

Tests

Test with Valid Credit Card Number

* Login EM.
* Test with input message that contains a valid credit card number:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/ns/order">
        <ns1:PurchaseOrder>
            <ns1:CustID>1111</ns1:CustID>
            <ns1:ID>2222</ns1:ID>
            <ns1:productName>iPod shuffle</ns1:productName>
            <ns1:itemType>Electronics</ns1:itemType>
            <ns1:price>145</ns1:price>
            <ns1:quantity>30</ns1:quantity>
            <ns1:status>Initial</ns1:status>
            <ns1:ccType>Mastercard</ns1:ccType>
            <ns1:ccNumber>1234-1234-1234-1234</ns1:ccNumber>
        </ns1:PurchaseOrder>
    </soap:Body>
</soap:Envelope>

View Report

* Login OSB web console.
* In left side panel, click Operations -> Reporting -> Message Reports.
* Click an entry in Report Index column, e.g. CCNumber= 1234-1234-1234-1234, to view message details.
* Click Operations -> Monitoring -> Dashboard.
* Click Pipeline Alerts to check that there is no Pipeline alerts.

Test Invalid Credit Card Number

* Login OSB console.
* Click Project Explorer -> ProxyServices.
* Click Launch Test Console debug icon for ValidateCredit proxy service.
* Simulate invalid XML payload by changing cca:CCNumber to cca:CCNumber1:

<cca:creditcardStatusRequest xmlns:cca="http://www.globalcompany.com/ns/CCAuthorizationService">
    <cca:CCNumber1>string</cca:CCNumber1>
</cca:creditcardStatusRequest>

* Click Execute.
* View error messages.
* Click Close.

View Report

* Login OSB web console.
* In left side panel, click Operations -> Monitoring -> Dashboard.
* Click Pipeline Alerts to check Pipeline alerts.

This entry was posted in soa11g. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.