Home > OSB > OSB11G Dynamic Routing Sample

OSB11G Dynamic Routing Sample

Dynamic Routing in OSB cab be used when the BusinessService endpoint required to be determine at runtime in message flow.

In this example , will see how BusinessService end point determined dynamically during runtime based on value in consumer request

Here the consumer will pass the below as request xml. On this based on the Country Code Value, BusinessService endpoint will be determined at runtime.

<cus:getCustomerStatus xmlns:cus="http://com/wordpress/rathinasaba/ws" xmlns:java="java:com.wordpress.rathinasaba.view">
         <cus:customer>
            <java:Name>
               <java:FirstName>Rathina</java:FirstName>
               <java:LastName>Sabapathy</java:LastName>
            </java:Name>
            <java:Occupation>Software Engineer</java:Occupation>
            <java:Address>
               <java:FlatNumber>6</java:FlatNumber>
               <java:Street>Sutherland Road</java:Street>
               <java:State>NSW</java:State>
               <java:Country>AU</java:Country>
            </java:Address>
         </cus:customer>
</cus:getCustomerStatus>



My Project Structure

ProjectStructure

ProjectStructure





Complete Service Overview
ProxyServiceOverview

ProxyServiceOverview





BusinessService :
I have created a Customer WebService ear. On deploying this component into Weblogic Server10.3.6 ,it will generate 3 WSDL files.
I have created 3 business service from Customer Service WSDLs.

Download this Customer WebService Component from here



ProxyService overview
1. In the first Assign activity based on the Country value, the Business Service will be decided and assigning the result to variable “serviceName”

Expression

if($body/cus:getCustomerStatus/cus:customer/java:Address/java:Country eq "AU")
then
    "OSB11G_DynamicRouting/bs/BS_AU_CustomerService"
else if($body/cus:getCustomerStatus/cus:customer/java:Address/java:Country eq "FJ")
then
    "OSB11G_DynamicRouting/bs/BS_FIJI_CustomerService"
else
	"OSB11G_DynamicRouting/bs/BS_NZ_CustomerService"



The namespaces “cus” and “java” used in XPath has been declared as shown in screeshot below.

DecisionPoint4BS

DecisionPoint4BS





2. In the second assign activity , am forming the below route element and assigning to a variable “dynaRoute”
Expression

<ctx:route>
	<ctx:service isProxy="false">{data($serviceName)}</ctx:service>
	<ctx:operation>{data("getCustomerStatus")}</ctx:operation>
</ctx:route>



RouteElementFormation

RouteElementFormation



3. Created Route node. Inside Route node , created Dynamic Routing node and entered $dynaRoute variable assigned in Proxy Service as shown below



DynamicRouting

DynamicRouting





Testing
Testing

Testing

Advertisements
Categories: OSB Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: