Вы находитесь на странице: 1из 5

Oracle SOA Suite 11g - Sample

SAMPLE NAME Capabilities COMPONENT OVERVIEW

: Mediator Dynamic Routing : Mediator Service Component

This sample demonstrates the dynamic message routing capabilities of the Mediator Service Component (aka Mediator).

WHAT YOU WILL LEARN


In this tutorial you will learn the basic steps and tools involved in: Designing custom document protocol in Oracle B2B Designing a SOA composite for Oracle B2B Testing and monitoring B2B and composite flow

PROVIDED FILES
Sample zip mediator_107_dynamicrouting.zip will contain following: jdev this directory will contain soa composite and jdev workspace. bin this directory will contain build scripts for building and deploying custom document protocol and associated composite. doc/mediator-107-dynamicrouting.pdf: instructions to build the project and walk through the tutorial [ this file ] artifacts: directory contains schema artifacts and input payloads.

STEP BY STEP INSTRUCTIONS


PREREQUISITE
Installation and configuration of the SOA suite and the JDeveloper are sufficient for executing this sample.

Oracle SOA Suite 11g - Sample Create an Application Connection to a target server Skip this section if you are already familiar with steps to create the weblogic application server connection. From the resource palette create an Application Server connection using the wizard. Name and Type: o Connection name = <any name> o Connection type = e.g. WebLogic 10.3 Authentication: o User name = <username> e.g. weblogic o Password = <password> e.g.weblogic1 Configuration: o Host name = host on which 11g is installed o Port = <port number> e.g. 7001 o WLS Domain = <domain name> e.g. soainfra Application deployment Skip this section if you are already familiar application deployment Right click the project Deploy-> CustomerRouter ->Deploy to Application Server When Revision ID dialog box appears, click next (default revision id is 1.0) Select the connection name, which is created in previous section and Click Next. Select the SOA server for which application has to be deployed. Click next. Repeat the same for DynamieMediator project. Click Finish

Installing and Running the Prebuilt Sample Installing the prebuilt Sample through JDev
Please execute the following steps to run the pre-built sample Open the MediatorDynamicRouting.jws SOA application in JDeveloper using the File Open menu. Double-click on the CustomerStatusLogger File Adapter in customerRouter project, to launch the file adapter wizard. Click on next until the File Directories step of the Wizard is reached. Please update the Directory for Outgoing Files text field to a value that you wish your application to write the files to. Please make sure the directory is accessible from the SOA server on which you expect to run the scenario.

Oracle SOA Suite 11g - Sample


Using the application deployment feature in JDeveloper, please deploy the CustomerRouter application to your SOA server. If the connection has not been configured already, you will need to do a one-time configuration of the connection.

Installing the prebuilt Sample through Ant


Go to <this sample home/bin directory Run ant seed-b2b-sample-artifacts for deploying pre-built B2B metadata Run ant all for building and deploying pre-built SOA Composite

Running the Sample


After the deployment of CustomerRouter, open DynamicRouter composite and then double-click on the OracleRules_DynamicCustomer_Router_execute1 component. This will open a DecisionTable where you need to update serviceBindingInfo field to point to right soap endpoints. Please replace the hostname and host port with SOA Server details. o For otherwise rule, provide http://<host name>:<host port>/soainfra/services/default/CustomerRouter!1.0/DefaultCustomerRouterService . o For Intel, it will be " http://<host name>:<host port>/soainfra/services/default/CustomerRouter!1.0/SilverCustomerRouterService ", o For Cisco, it will be http://<host name>:<host port>/soainfra/services/default/CustomerRouter!1.0/GoldCustomerRouterService and o For HP, it will be http://<host name>:<host port>/soainfra/services/default/CustomerRouter!1.0/PlatinumCustomerRouterService After this modification, save the project and deploy DynamicCustomerRouter application. Please open the EM Console (em ) or SOAConsole (for standalone install) with the appropriate URL http://<hostname>:<portnum>/em or http://<hostname>:<portnum>/SOAConsole respectively. Click on DynamicRouter composite. Select Test option and it will show 2 soap service endpoints. Select CustomerRoutingLogger endpoint. This will open up EM SOA test page and provide a value for customer name field and test.

VERIFYING EXECUTION
Please check the target directory (for CustomerRouterlogger) for one copy of customer_1.xml file. The file will contain the name of the customer you provided and the status which will be default , silver , gold or platinum based on the customer name. If customer name is Intel , the status field will have silver, if name is Cisco then status will be gold, if the name is HP then status will be platinum and otherwise it will be default. Please open the EM Console (em ) or SOAConsole (for standalone install) with the appropriate URL http://<hostname>:<portnum>/em or

Oracle SOA Suite 11g - Sample


http://<hostname>:<portnum>/SOAConsole respectively. Click on the DynamicCustomerRouter to see the project dashboard. Navigate through the Last 5 instances section to open the instance of your choice by clicking on the instance ID. Click on the mediator hyperlink in the Instance column to see the detailed execution trail of the mediator.

BUILDING THE SAMPLE


Please execute the following steps to build the scenario from scratch and run it Step 1: Application Creation Create a new application CustomerRouter in JDeveloper In the ensuing Create Project window, enter project name CustomerRouter to this application From the File New menu, add a new SOA Composite (under SOA Tier) to this project using the Empty Composite option for the Composite Template In the ensuing Create Project window, enter project name DynamicCustomerRouter to this application From the File New menu, add a new SOA Composite (under SOA Tier) to this project using the Empty Composite option for the Composite Template

Step 2: Dynamic Mediator Flow Creation Open DynamicCutomerRouter project composite.xml. Drag and drop an one-wayMediator (Service Component) from the Component Palette/SOA tab from the right-hand side of the diagrammer into the Components swim-lane. Name the component as CustomerRoutingLogger and specify to use CustomerData.xsd [provide as part of the sample for request. Similarly, create another asynchronous mediator component and specify CustomerData.xsd for request and callback operation. Double click on the DynamicCustomerRouter to open the DynamicCustomerRouter.mplan editor. Click on+ icon and it will show static routing rule and dynamic routing rule options. Select dynamic routing rule option. This option will take few second to a minute to created artifacts for dynamic routing rule [Rule service, decision table, dummy reference etc.] Double click on the CustomerRoutingLogger to open the CustomerRoutingLogger.mplan editor. Click on+ icon and it will show static routing rule and dynamic routing rule options. Select static routing rule option and when asked, provide DynamicCustomerRouter as target service. As CustomerRoutingLogger is an one-way mediator component, UI will prompt to provide handler for callback coming from DynamicCustomerRouter. Create outbound File Adapter reference [CustomerStatusLogger] using same schema - CustomerData.xsd

Oracle SOA Suite 11g - Sample


In the File Naming Convention field, please use the %SEQ% suffix to distinguish between several runs of this flow Creating Callback handler for CustomerRoutingLogger o Click on the green plus sign to launch a dialog Target Type; click on Service to open a Target Services browser. Open the References in the tree to choose the Write operation from CustomerStatusLogger reference. Step 3: External Mediator Flow Creation Copy DynamicReference_DynamicCustomerRouter_execute1.wsdl from DynamicCustomerRouter project to CustomerRouter project as AbstractRouter.wsdl. Remove the concrete wsdl constructs like service and binding so that it doesnt interfere with the dynamic invocation. This step makes sure your wsdl namespace and operation names matches with the dynamic reference defined in DynamicCustomerRouter project. Open CutomerRouter project composite.xml. Drag and drop one-way Mediator (Service Component) from the Component Palette/SOA tab from the right-hand side of the diagrammer into the Components swim-lane. Name the component as DefaultCustomerRouter and specify to use AbstractRouter.wsdl as wsdl. It will create a mediator component and connected soap service. Double click on the DefaultCustomerRouter to open the DefaultCustomerRoutier.mplan editor. Click on+ icon and it will show static routing rule and dynamic routing rule options. Select static routing rule option and when asked specify it as echo mediator to that it returns the response to same service which invoked. Select execution type parallel so that it can respond in separate thread to make the operation asynchronous. Specify a mapping xsl for callback transformation. Inside the XSL , copy the customer name from source to target and specify text default for status. Similarly, create 3 other echo mediator components SilverCustomerRouter, GoldCustomerRouter, PlatinumCustomerRouter, in the same way. In xsl specify the text as silver, gold, platinum for respective mediator components. o