OracleSOASuiteTutorial

Download

* For 10gR1: http://download.oracle.com/otn/nt/ias/101310/soademo_101310_prod.zip

Setup Environment

Create DB Schema

SET ORACLE_HOME=C:\prog\oracle\product\10.2.0\db_1
SET ORACLE_SID=orcl
echo %ORACLE_HOME%
echo %ORACLE_SID%
 
SET SOADEMO_HOME=C:\jml\WORK\rfid\doc\com\oracle\soa\10.1.3.1.0\SOADEMO
echo %SOADEMO_HOME%
cd %SOADEMO_HOME%
 
sqlplus /nolog
SQL> CONNECT sys/orcl AS sysdba
SQL>@build.sql
SQL> CONNECT soademo/oracle
Connected.
SQL> SELECT * FROM tab;
 
TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
SSN                            TABLE
ITEMS                          TABLE
ADDRESS                        TABLE
CUSTOMER                       TABLE
CUSTOMER_ADDRESS               TABLE
ORDERS                         TABLE
PRODUCT                        TABLE
EJB_TAB_ID_GEN                 TABLE
FEDEXSHIPMENT                  TABLE
 
9 ROWS selected.

Define Data Source and Connection Pool in Oracle Application Server

* Create Connection Pool: soademo_pool

* Create Data Source: jdbc/soademoDS

* Create a Database Adapter Connection Factory: eis/DB/soademo

Set Up Connections in Oracle JDeveloper

* Create a Database Connection to the SOADEMO Schema: SOADEMO

* Create a Connection to Oracle Application Server: SoademoApplicationServer

* Create a Connection to the Integration Server: SoademoIntegConnection

Create the SOADEMO Application in JDeveloper

CustomerService Project

The CustomerService project provides methods that enable client applications, such as the SOADemo-Client application, to retrieve customer information from the database and add customers to the database.
* Create a New Project for CustomerService
* Create Entity Beans from Tables in the Database
– Create New -> EJB -> Entities from tables (JPA/EJB 3.0)
– Select Address and Customer tables
* Edit persistence.xml to include

jdbc/soademoDS

* Create a Session Bean in the business Directory
– Create New -> EJB -> Session Bean (EJB1.1/2.x/3.0)
* Define Additional Queries in Customer.java
* Use a Database Sequence to Generate Address IDs in Address.java
* Edit Session Facade for the Session Bean (CustomerServiceBean.java)
* Add and Modify Methods in the Session Bean (CustomerServiceBean.java)
– Modify queryCustomerFindCustomerById
– Modify queryCustomerFindCustomerByEmail
– Add getCustomerStatus and addNewCustomer Methods
* Add JSR-181 Annotations to the Web Service Endpoint Interface (CustomerService.java)
* Create EJB JAR Deployment Profile for the CustomerService Project
* Deploy CustomerService
* View the WSDL for CustomerService
– http://localhost:8888/CustomerService/CustomerService?WSDL

FulfillmentESB Project

The FulfillmentESB project is an ESB project. After an order has been approved, the SOAOrderBooking project invokes the FulfillmentESB project to determine the shipping method for the order.
* Create a New Project for FulfillmentESB
* Create a System Called “Fulfillment”
* Create the “OrderFulfillment” Routing Service
* Create the “Shipment” Routing Service
* Create the “USPSShipment” Adapter (File Adapter)
* Create the “FedexShipment” Adapter (Database Adapter)
* Create the “FulfillmentBatch” Adapter (JMS Adapter)
* Create Routing Rules
– Between OrderFulfillment and Shipment
– Between OrderFulfillment and JMS Adapter
– Between Shipment and USPSShipment
– Between Shipment and FedexShipment
* Register the FulfillmentESB Project

CreditService Project

Web services from WSDL. The CreditService project checks whether a customer’s credit card is valid or not.
* Create a New Project for CreditService
* Copy the WSDL File
* Generate Java from the WSDL
* Build CreditService
* Write the Code to Perform Credit Card Validation
* Verify Hostname and Port in CreditService.wsdl
* Update the Context-Root
* Rebuild CreditService

RapidService Project

Web services from Java. The RapidService project represents a supplier that provides price quotes for customer orders.
* Create a New Project for RapidService
* Add JSR-181 Library to the RapidService Project
* Create Item.java
* Create Quote.java
* Create RequestQuote.java
* Compile the Files
* Publish the Project as a Web Service
* Verify the Hostname and Port in the Generated WSDL File
* Set the Context Root to RapidService
* Edit the Deployment Descriptor
* Deploy the RapidService Project

SelectManufacturer Project

The SelectManufacturer project is an asynchronous BPEL process. This means that it contains a receive activity to initiate the BPEL process flow and an invoke activity to call back the client asynchronously with the results (that is, the quote) at the end of the flow.
* Create a New BPEL Project for SelectManufacturer
* Create “SelectService” Partner Link
* Define Variables for the SelectManufacturer Project
– inputVariable
– outputVariable
* Receive Order Data from the Client through a Receive Activity
* Assign Values to be Returned
* Return Values to the Client Using an Invoke Activity
* Deploy the BPEL Process
* Viewing SelectManufacturer in the Oracle BPEL Control

SOAOrderBooking Project

A BPEL project for the main flow in the SOA Order Booking application. It sends the order information to the appropriate services at the appropriate times. For example, it contacts CreditService to check the customer’s credit card, and if the credit card is acceptable, it contacts the suppliers (Select Manufacturer and Rapid Distributors) to get price quotes for the order.

Setup

* Create a New BPEL Project for SOAOrderBooking
* Copy Files to ‘SOAOrderBooking\bpel’ subdirectory.
– SOAOrderBooking.wsdl
– OrderBookingPO.xsd
– OrderBookingRules.xsd

Define Variables for the SOAOrderBooking Project

* Create a new variable named ‘inputVariable’ of message type ‘SOAOrderBookingRequestMessage’
* Create a new variable named ‘outputVariable’ of message type ‘SOAOrderBookingResponseMessage’

Create “client” Partner Link

This client partner link represents the client, which passes data to the receiveInput activity and gets invoked at the end of the flow to receive the return value.
* Drag and drop ‘Parner Link’ icon.
– Name: ‘client’.
– WSDL File: SOAOrderBooking.wsdl
– Partner Link Type: select SOAOrderBooking (automatically filled in for you).
– Partner Role: select SOAOrderBookingRequester.
– My Role: select SOAOrderBookingProvider.
– Process: leave it blank.

Receive Input from the Client (Receive Activity)

Create a receive activity to receive the input data from the client. In the receive activity, you also define a sensor to send data to a JMS topic.
* Create the Receive Activity
– Drag and drop ‘Receive’ activity.
Name: receiveInput
Operation: initiate
Variable: inputVariable
Create instance: check
* Create a Sensor for the Receive Activity
– Click ‘Create’ in sensor tab
Name: InstanceStart
Evaluation time: complete
Variable XPath: $inputVariable
Output Namespace: http://www.globalcompany.com/ns/OrderBooking
Output Datatype: SOAOrderBookingRequestMessage
– Create sensor action
Name: InstanceStart.
Publish Type: JMS Topic.
JMS Connection Factory: jms/TopicConnectionFactory.
Publish Target: jms/demoTopic.
Filter: leave blank.
Enable: select this option.

Insert Order Information in the Database (“InsertOrderIntoDB” Scope)

In this scope, you create activities to insert the order information into the database.

Create a Database Adapter for Writing to the ORDERS Table

* Drag and drop ‘Database Adatper’ icon.
Name: Order
– Database info
Connection: SOADEMO
JNDI Name: eis/DB/SOADEMO
Perform an operation on a table: Insert or Update (Merge)
Imprt table: ORDERS, ITEMS
– Partner role: Order_role

Create a Database Adapter for Retrieving the Order ID from the Database

Before you can insert order information in the ORDERS table in the database, you need to retrieve the order ID from the database. The order ID is generated from a database sequence.
* Drag and drop ‘Database Adapter’ icon
Name: OrderSequence
Operation type: Execute Custom SQL
SQL: select order_seq_id_gen.nextval from dual
Partner role: OrderSequence_role

Create the “InsertOrderIntoDB” Scope

* Drag and drop ‘Scope’ icon.
– Name: enter InsertOrderIntoDB.
– Variable Access Serializable: do not select.
* Create new variable named ‘orderRequest’ of message type ‘OrdersColllection_msg’
* Create new variable named ‘orderSequenceInput’ of message type ‘OrderSequenceInput_msg’
* Create new variable named ‘orderSequenceOutput’ of message type ‘OrderSequenceOutputCollection_msg’

Retrieve the Order ID from the Database Sequence (“GetOrderId” Invoke Activity)

* Drag and drop ‘Invoke’ icon.
* Drag Invoke icon arrow and drop in ‘OrderSequence’ database adatper.
– Name: GetOrderId
– Operation: select OrderSequence.
– Input Variable: orderSequenceInput.
– Output Variable: orderSequenceOutput.

Prepare the Order ID and Order Status Information (“AssignOrderStatus” Assign Activity)

* Drag and drop ‘Assign’ activity. Name it ‘AssignOrderStatus’
* Create order id copy operation
* Create order status copy operation

Create the Mapping File (“TransformOrder” BPEL Service)

In this transform service, you create a file called TransformOrder.xsl to map the incoming order information to the schema defined in Order_table.xsd, which prepares it for insertion in the database. Order_table.xsd was created by the Adapter Configuration wizard that you ran in Section 8.7.1, “Create a Database Adapter for Writing to the ORDERS Table”.
* Drag and drop ‘Transform’ icon. Name it ‘TransformOrder’
* In Transform tab
– Source Variable: inputVariable.
– Source Part: payload.
– Target Variable: orderRequest.
– Target Part: OrdersCollection.
– Mapper File: enter TransformOrder.xsl and click the Create Mapping icon (the middle icon). This displays the Data Mapping tool for TransformOrder.xsl.

Insert the Order Information into the Database (“InsertOrder” Invoke Activity)

* Drag and drop ‘Invoke’ icon.
* Drag Invoke icon arrow and drop in ‘Order’ dadabase adatper.
– Name: enter InsertOrder.
– Partner Link: should be set to Order.
– Operation: select write.
– Input Variable: orderRequest.

Retrieve Information About the Customer (“CustomerService” Scope)

This scope invokes the CustomerService service to retrieve information about the customer. It uses the assign activity to populate variables with the returned information.
* Create the “CustomerService” Partner Link
– Copy CustomerSvc.wsdl to bpel directory
– Verify CustomerSvc.wsdl for host/port
– Drop Partner Link icon in a Services swimlane
* Create the “CustomerService” Scope
– Drag and drop ‘Scope’ icon. Name it ‘CustomerService’.
– Create variable named ‘customerServiceRequest’ of message type ‘CustomerService_findCustomerById’
* Assign Customer ID to the findCustomerById Operation (“AssignRequest” Assign Activity)
– Drag and drop ‘Assign’ icon. Name it ‘AssignRequest’.
– Create new copy operation to copy customer id to scope.
* Create a Variable to Contain the Results of findCustomerById (“customerServiceResponse” Process Variable)
The customerServiceResponse variable is used to contain the results of the findCustomerById operation.
– Create the ‘customerServiceResponse’ variable in the SOAOrderBooking scope with message type ‘CustomerService_findCustomerByIdResponse’. The variable is created at this level so that any activity in this BPEL process can access it.
* Invoke findCustomerById (“GetCustInfo” Invoke Activity)
– Drag and drop ‘Invoke’ icon.
– Drag invoke arrow and drop into ‘CustomerService’ partner link.
Name: GetCustInfo
Operation: findCustomerById
Input variable: customerServiceRequest
Output variable: customerServiceResponse
* Create the “AssignInitialCustomerResponse” Assign Activity
This assign activity appends the customer’s first name and last name to the payload part of the inputVariable. It uses an XML fragment to perform this append operation.
* Copy the Customer’s First and Last Names to the inputVariable (“AssignCustomerResponse” Assign Activity)
This assign activity assigns the first and last names of the customer (which were retrieved from the database) to the inputVariable.

Verify the Customer’s Credit Card (“CreditService” Scope)

This scope verifies the credit of the customer. If a customer does not pass the credit check, the scope throws a fault and does not continue with the rest of the flow.
* Create “CreditValidatingService” Partner Link
– Copy CreditValidatingService.wsdl to bpel directory
– Verify CustomerSvc.wsdl for host/port
– Drop Partner Link icon in a Services swimlane
* Create the “CreditService” Scope
– Drag and drop a new scope. Name it CreditService.
– Create a new variable ‘validateRequest’ of ‘CreditCardValidationRequestMessage’ message type.
– Create a new variable ‘validateResponse’ of ‘CreditCardValidationResponseMessage’ message type.
* Assign the Credit Card Number and Credit Card Type Information (“InitializeRequest” Assign Activity)
– Drag and drop ‘Assign’ activity to scope. Name it ‘InitializeRequest’.
– Create a new ‘Copy Operation’ to copy from ‘/ns9:findCustomerByIdResponse/ns9:return/ns9:creditcardnumber’ to ‘/ns12:CreditCard/ccNum’
– Create a new ‘Copy Operation’ to copy from ‘/ns9:findCustomerByIdResponse/ns9:return/ns9:creditcardtype’ to ‘/ns12:CreditCard/ccType’
* Verify the Customer’s Credit Card (“InvokeCreditService” Invoke Activity)
– Drag and drop ‘Invoke’ icon to scope.
– Drag Invoke arrow and drop in ‘CreditValidatingService’ partner link.
Name: InvokeCreditService
Partner link: CreditValidatingService
Operation: verifyCC
Input variable: validateRequest
Output variable: validateResponse
* Create the “OrderBookingFault” Process Variable
– Open the main ‘SOAOrderBooking’ scope.
– Add a new variable ‘OrderBookingFault’ of ‘SOAOrderBookingFaultMessage’ message type.
* Check the Results of the Credit Card Validation (Switch Activity)
– Drag and drop ‘Switch’ activity below ‘InvokeCreditService’ activity.
– Delete ‘otherwise’ case
– Build expression bpws:getVariableData(‘validateResponse’,’valid’,’/ns12:valid’) = ‘false’
* Set the Value of the OrderBookingFault Variable (“AssignFault” Assign Activity)
– Drag and drop an ‘Assign’ activity onto switch case activity. Name it ‘AssignFault’
* Create the “ThrowCreditFault” Throw Activity
– Drag and drop a ‘Throw’ activity below ‘AssignFault’ activity. Name it ‘ThrowCreditFault’

Set up Oracle Business Rules

* Create sample repository
– Create ‘rules\oracle’ directory in ‘bpel’ directory.
– Open *IE*. Login http://localhost:8888/ruleauthor/. Open Repository tab.
– Create ‘sample_repository’ in SOADEMO\SOAOrderBooking\bpel\rules\oracle directory.
* Create a Dictionary in the Repository: A dictionary typically contains rulesets for an application.
– Create new dictionary named ‘OrderBookingRules’
* Copy OrderBookingRules.xsd to the Oracle Application Server Machine (if not already done)
* Generate JAXB Classes for the Elements in the XML Schema
– Click ‘Definitions’ tab -> XML Fact -> Create
XML Schema: OrderBookingRules.xsd
JAXB Class Directory: rules
Package: com.oracle.demos.orderbooking
– Click ‘Add Schema’
* Import the JAXB Classes into the Oracle Business Rules Data Model: After generating the JAXB classes, you can import them into the Oracle Business Rules data model. These JAXB classes become XML facts that you can use when you create your rules.
– Check ‘com’
– Click ‘Import’
* Define a Variable in the Data Model
– Click Variable -> Create
* Create a Ruleset
* Create Rules
– Create the “belowLimit” Rule
– Create the “overLimit” Rule
– Create the “platinumMember” Rule

Determine If an Order Requires Manual Approval (“RequiresManualApproval” Decide Activity)

* Create the Activities in the “RequiresManualApproval” Decide Activity
– Drag and drop a ‘Decide’ icon after ‘CreditService’ scope. Name it ‘RequiresManualApproval’
* Copy Order Total and Customer Status Information (“BPEL_Var_To_Rule_Facts” Assign Activity)
– Double click ‘BPEL_Var_To_Rule_Facts’
* Copy the ConversationId to the dsIn Variable (“BPEL_Header” Assign Activity)
– Double-click the “BPEL_Header” activity to display the Assign dialog
* Create the “requiresApproval” Process Variable
* Copy the Result of the Decision Service to the requiresApproval Variable (“Facts_To_BPEL_Var” Assign Activity)

Set Up a Form to Process Orders That Require Manual Approval (“requiresApproval” Switch)

* Create the Switch
* Set the Condition for the
* Create a Sequence in the Branch
* Create a Human Task
* Create a Form for the Worklist Application: When a manager wants to see the orders that are waiting for approval, the manager logs into the Worklist application. You can access this application from the Start menu of the machine running Oracle Application Server: Start > Programs > Oracle – ORACLE_HOME_NAME > Oracle BPEL Process Manager > Worklist Application.

Handle the Manager’s Response (“requiresApproval” Switch)

JDeveloper created a switch for you automatically after the human task activity.
* Handle the Reject Case
– Set the Status of the Order (Assign Activity)
– Create a Throw Activity
* Handle the Approve Case
– Drag and drop ‘Empty’ activity
* Handle the Expired Case
– Drag and drop ‘Empty’ activity

Choose a Supplier (“SelectSupplier” Scope)

This scope sends the order information to the two suppliers, Select Manufacturer and Rapid Service, and the suppliers return their bids for the orders. The scope then chooses the supplier that provided the lower bid.
* Create the “SelectManufacturer” Partner Link
– Drag and drop ‘Partner Link’ icon into Services swimlane.
Name: SelectService
WSDL: SelectManufacturer
Partner Role: SelectServiceProvider
My Role: SelectServiceRequester

* Create the “RapidService” Partner Link
– Copy RapidService.wsdl to bpel directory.
– Check wsdl file for hostname and port.
– Drag and drop ‘Partner Link’ icon into Services swimlane.
Name: RapidService
Partner Role: RapidQuote_Role
My Role: blank
* Create the “SelectSupplier” Scope
– Drag and drop ‘Scope’ icon. Name it ‘SelectSupplier’
– Create variable ‘selectManufacturerResponse’ of message type ‘RequestQuote_processRequestQuoteResponse’
– Create variable ‘rapidManufacturerResponse’ of message type ‘RequestQuotePortType_POItemsQuoteResponse’
* Create a Flow Activity
You use a flow activity in order to send out requests to more than one supplier at the same time. In the case of this application, you send out requests to two suppliers: Select Manufacturer and Rapid Service.
– Drag and drop ‘Flow’ icon into scope. Name it ‘CallManufacturers’

Set the Activities for Select Manufacturer

* Create a Scope for SelectManufacturer
– Drag and drop ‘Scope’ icon into left side of the flow. Name it GetSelectMfrQuote.
– Create variable ‘manufacturerRequest’ of message type ‘RequestQuote_processRequestQuote’
* Create a Transform Activity (“TransformSelectRequest” Transform Activity)
– Drag and drop ‘Transform’ icon into scope. Name it ‘TransformSelectRequest’
Source Variable: inputVariable
Source Part: payload
Target Variable: manufacturerRequest
Target Part: parameters
– Set Mapper File to ‘SelectTransformation.xsl’ and click ‘Create Mapping’ icon to generate the mapper file.
* Create an Invoke Activity
This invoke activity invokes the SelectManufacturer partner link.
– Drag and drop ‘Invoke’ icon in scope.
– Drag invoke arrow and drop into ‘SelectService’ partner link. Name it ‘InvokeSelectManufacturer’
Operation: processRequestQuote
Input Variable: manufacturerRequest
* Create a receive activity
This receive activity receives the quote from the Select Manufacturer.
– Drag and drop ‘Receive’ icon
– Drag receive arrow and drop into ‘SelectService’ partner link.
Name: ReceiveSelectManufacturer
Operation: processRequestQuoteResponse
Variable: selectManufacturerResponse

Set the Activities for Rapid Manufacturer

* Create a Scope for Rapid Manufacturer
– Drag and drop ‘Scope’ icon into right side of the flow. Name it ‘CallRapidManufacturer’
– Create variable ‘manufacturerRequest’ of message type ‘RequestQuotePortType_POItemsQuote’
* Create a Transform Activity (“TransformRapidRequest” Transform Activity)
– Drag and drop ‘Transform’ icon into scope. Name it ‘TransformRapidRequest’
Source Variable: inputVariable
Source Part: payload
Target Variable: manufacturerRequest
Target Part: parameters
– Set Mapper File to ‘RapidTransformation.xsl’ and click ‘Create Mapping’ icon to generate the mapper file.
* Create an Invoke Activity
This invoke activity invokes the RapidService partner link.
– Drag and drop ‘Invoke’ icon in scope.
– Drag invike arrow and drop into ‘RapidService’ partner link. Name it ‘InvokeRapidManufacturer’
Operation name: POItemsQuote
Input Variable: manufacturerRequest
Output Variable: rapidManufacturerResponse

Create a Switch to Pick the Lower-Priced Quote

* Drag and drop a ‘Switch’ icon below
* Name it ‘SelectByPrice’
* Set the Condition for the Switch
– Double click box
– Set condition to
number(bpws:getVariableData(‘selectManufacturerResponse’,’parameters’,’/ns16:processRequestQuoteResponseElement/ns16:return/ns16:supplierPrice’) < bpws:getVariableData('rapidManufacturerResponse','parameters','/ns17:POItemsQuoteResponse/ns17:return/ns17:supplierPrice')) * Set the Activities for Select Manufacturer: Define the activities for Select Manufacturer if it bid the lower quote. In this case, assign the bid value to the supplierPrice field of inputVariable. - Drag and drop an 'Assign' activity into box. Name it ‘AssignSelectManufacturer’
– Create a copy operation to copy supplier price from SelectManufacturer to inputVariable
– Create a copy operation to copy supplier name from SelectManufacturer to inputVariable
* Set the Activities for Rapid Distributor
– Drag and drop an ‘Assign’ activity into box. Name it ‘AssignRapidManufacturer’
– Create a copy operation to copy supplier price from RapidManufacturerto inputVariable
– Create a copy operation to copy supplier name from RapidManufacturerto inputVariable

Determine the Shipping Method (“PostFulfillmentReq” Scope)

This scope invokes the FulfillmentESB project, which determines how an order is to be shipped. For orders $500 and over, Fedex is the shipment method. For orders less than $500, USPS is the shipment method. These rules are defined in the FulfillmentESB project.
* Create the “OrderFulfillment” Partner Link
– Drag and drop ‘Partner Link’ icon. Name it ‘OrderFulfillment’
* Create the “PostFulfillmentReq” Scope
– Drag and drop ‘Scope’ activity. Name it ‘PostFulfillmentReq’
– Create a new variable named ‘orderFulfillmentRequest’ with message type ‘PurchaseOrder_request’
* Copy Order Information to Scope Variable (“initializeRequest” Assign Activity)
– Drag and drop ‘Assign’ activity onto scope. Name it ‘initializeRequest’
– Create a new ‘Copy Operation’ and copy purchaseOrder from inputVariable to orderFulfillmentRequest
* Invoke OrderFulfillmentESB (“PostFulfillmentReq” Invoke Activity)
– Drag and drop ‘Invoke’ activity. Drop arrow onto OrderFulfillment partner link.
– Name Invoke activity ‘PostFulfillmentReq’ with operatoin ‘execute’ and input variable ‘orderFulfillmentRequest’
* Create a Catch-All Branch for the Scope
Create a catch-all branch to catch all exceptions.
– Click ‘Add CatchAll Branch’ icon
– Drag and drop ‘Empty’ activity into catchall branch

Set the Order Status to “Completed” (“SetFinalOrderStatus” Scope)

This scope uses a database adapter to update the order status in the database.
* Create the “OrderStatus” Database Adapter
– Drag and drop ‘Database Adapter’ into Service lane. Name it ‘OrderStatus’
– Setup to ‘Update only’ on ‘ORDERS’ table
* Create the “SetFinalOrderStatus” Scope
– Drag and drop ‘Scope’ activity. Name it ‘SetFinalOrderStatus’
– Create a variable named ‘orderStatusRequest’ of message type ‘OrdersCollection_msg’
* Prepare the Order ID and Status (“AssignOrderStatus” Assign Activity)
– Drag and drop ‘Assign’ icon into scope. Name it ‘AssignOrderStatus’.
– Create a copy operation and copy order id to scope.
– Create another copy operation and copy string(‘completed’) to status
* Update the Order Status in the Database (“UpdateOrderStatus” Invoke Activity)
– Drag and drop ‘Invoke’ icon into scope
– Drag arrow and drop into OderStaus partner link.
Name: UpdateOrderStatus
– Input variable: orderStatusRequest

Send an Email Notification to the Customer (“NotifyCustomer” Scope)

This scope uses the notification service to send an email to the customer when the order is fulfilled.
* Create the Notification Scope
– Drag and drop ‘Email’ activity icon. Name it ‘NotifyCustomer’
– Use XPath expression for email detals

Call Back the Client (“callbackClient” Invoke Activity)

* Create the Invoke Activity
– Drag and drop ‘Invoke’ activity icon.
– Drag arrow and drop on ‘Client’ partner link.
Name: callbackClient
Input variable: outputVariable
– Add a Sensor
Name: InstanceCompleted
Evaluation Time: Completion
Activity variable: inputVariable
Activity action: send to JMS topic

Add a Catch Branch to the Project

* Add a “client:OrderBookingFault” Catch
* Catch dialog
Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking.
Local Part: enter OrderBookingFault.
Fault Variable: enter OrderBookingFault.
* Create a Sequence
– Drag and drop a sequence icon in the catch area.
* Create a Scope
– Drag and drop Scope icon in the catch area
Name: SetOrderStatus
– Create a variable named ‘orderStatusRequest’ of message type ‘OrdersColllection_msg’
* Create the Assign Activity
– Drag and drop ‘Assign’ activity onto the scope. Name it AssignOrderStatus.
– Create three copy operations to copy purchase order id, order status, and comments into scope.
* Create the Invoke Activity
– Drag and drop ‘Invoke’ activity. Drag arrow and drop into ‘OrderStatus’ database adapter.
Name: SetFaultedOrderStatus.
Input variable: orderStatusRequest
* Create a Sensor in the Invoke Activity
Name: InstanceFaulted
Evaluation Time: Completion
Input variable: OrderBookingFault
Action: publishh to JMS topic

Deploy the Project

* Open build.properties

platform = ias_10g
domain = default
rev = 1.0
admin.user = oc4jadmin
admin.password =welcome1
http.hostname = usres-ming-lj2.na.uis.unisys.com
http.port = 8888
j2ee.hostname = usres-ming-lj2.na.uis.unisys.com
rmi.port = 12401
opmn.requestport = 6003
oc4jinstancename = home

* Add build.properties to ant.xml
* Run ant

Creating the OrderBookingESB Project

The OrderBookingESB project is the entry point to the SOA Order Booking application. The SOADemo-Client application invokes the OrderBookingESB project when a customer clicks the Place Order button. The OrderBookingESB project invokes the SOAOrderBooking project, which is a BPEL project that defines the main flow of the SOA Order Booking application. The OrderBookingESB project is an ESB project.

Create a New Project for OrderBookingESB

* Create a new ESB Project. Name it ‘OrderBookingESB’

Create a System Called “OrderBooking”

Create the “OrderBookingService” Routing Service

* Copy xsd files to project root directory.
– OrderBookingRequest.xsd
– OrderBookingPO.xsd
* Drag and drop Routing service
Name: enter OrderBookingService.
– System/Group: set to OrderBooking.
– Generate WSDL From Schemas: select this option.
– Schema Location: SOAOrderBookingProcessRequest.
– Operation Name: enter initiate.
– Namespace: enter http://www.globalcompany.com/ns/OrderBooking.
* Invoke the SOAOrderBooking Process (“OrderBookingProcess” External Service)
– Drag and drop ‘SOAP Service’.
Name: OrderBookingProcess
WSDL File: http://USRES-MING-LJ2.na.uis.unisys.com:8888/orabpel/default/SOAOrderBooking/SOAOrderBooking?wsdl
Port Type: SOAOrderBooking
* Set up Routing Rules for OrderBookingService
Set up routing rules so that requests can go from OrderBookingService to OrderBookingProcess.
– Add routing rule
– Add filter
* Register OrderBookingESB project.

Interfacing the Client Application with the SOA Order Booking Application

* Create SOADEMO-Client application.

Invoking Services from CustomerService

This section describes how to generate a web service proxy for CustomerService, and how to call it from the client application.

Generate a Web Service Proxy for CustomerService

* Create a new Empty Project. Name it ‘CustomerService’
* Create a new Web Service Proxy
WSDL Document URL: http://usres-ming-lj2.na.uis.unisys.com:8888/CustomerService/CustomerService?WSDL
Port Endpoints, select Run against a service deployed to an external server
Package Name: oracle.soademo.view.services
Root Package for Generated Types: oracle.soademo.view.services.runtime.
Select all the options on the page:
* Build files

Write Code to Invoke the Web Service Proxy for CustomerService

Invoking the OrderBookingESB Project

* Retrieve the Concrete WSDL URL from ESB console (OrderBooking -> OrderBookingService -> Definition)
http://usres-ming-lj2.na.uis.unisys.com:8888/esb/wsil/OrderBooking/OrderBookingService?wsdl

Create the Project in the Client and Create the Web Service Proxy

* Create a new Empty Project. Name it ‘OrderService’
* Create a new Web Service Proxy
WSDL Document URL: http://usres-ming-lj2.na.uis.unisys.com:8888/esb/wsil/OrderBooking/OrderBookingService?wsdl
Port Endpoints: select Run against a service deployed to an external server. Replace localhost with the name of the machine running the OrderBookingESB project.
Package Name: enter oracle.soademo.view.services.
Root Package for Generated Types: enter com.globalcompany.ns.order.
Select all the options on the page.
* Build files

References

* Oracle® SOA Suite Quick Start Guide 10g (10.1.3.1.0) Part Number B28938-01

This entry was posted in bpel, esb, oc4j, oracle. Bookmark the permalink.