Showing posts with label OSB. Show all posts
Showing posts with label OSB. Show all posts

Monday, 15 September 2014

Installing OSB 11.1.1.6 with OSB IDE on windows 7 64 bit

Installing OSB on windows 7 64 bit:

It is not very straight forward to install OSB server, OSB IDE ,weblogic on windows 7 64 bit. For 32 bit we get OEPE with weblogic which is quite easy to install, but on 64 bit you don't have OEPE with weblogic. You need to install weblogic separately then install OEPE . Here selecting the OEPE version is tricky. If weblogic version is 11.1.1.6 , it does not mean you have to select OEPE version of 11.1.1.6. It will not work. Infact the correct version of OEPE is 11.1.1.8. Now what about OSB? which version should be selected? OSB should be of version 11.1.1.6 . So in summary

weblogic: 11.1.1.6

OEPE: 11.1.1.8

OSB 11.1.1.6

Important points

1)Weblogic and OSB versions should be same if you want OSB IDE to be installed.

So weblogic is 11.1.1.4 , then OSB should be 11.1.1.4.

Incase if they don’t match then while installing OSB (from osb_generic_11.1.1.4) you may get error as “weblogic is not suited for this version of IDE” at step 4 (Typical/Custom step)

2)OEPE should be compatible with the OSB version.

Here are the list of compatible OEPE with OSB . There is no document for this though

OSB Weblogic Server OEPE

11.1.1.6.0 10.3.6 11.1.1.8.0

11.1.1.5.0 10.3.5 11.1.1.7.2

11.1.1.4.0 10.3.4 11.1.1.6.1

11.1.1.3.0 10.3.3 11.1.1.5

STEP1: Install JDK

Install JDK (Jrockit can be preferred)

jrockit-jdk1.6.0_26-R28.1.4-4.0.1-windows-x64(1) should be installed .Always prefer Jrockit over JDK as Jrocking has very good performance

STEP2: Install Weblogic

1. Open a terminal and go to the folder where wls1036_generic file is.

2. Execute the following command:

Double click on the file

3. When the oracle weblogic installer starts, click next and enter the folder you want to use as Middleware Home Directory, for example:

E:\InstalledSoftwares\oracle\fmw11116

4. Choose the typical installation (or customise if you need). Better to select customize as you can install examples also

5. On the JDK installer screen, the installer should automatically recognise the JDK installed during step 1. If not, click on “Browse” button and point to JDK directory (e.g. /jrocking).

6. Finish the installation.

STEP 3 – Install Oracle Enterprise Pack for Eclipse

Download from

http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/index.html

Just extract the oepe-indigo-all-in-one-11.1.1.8.0.201110211138-win32-x86_64

content into a folder named “oepe” in you middleware home directory, for example:

E:\InstalledSoftwares\oracle\fmw11116\oepe-indigo11.1.1.8.0_64

STEP 4 – Install OSB

Download from :http://www.oracle.com/technetwork/middleware/service-bus/downloads/index.html

1. Extract the downloaded zip file (ofm_osb_generic_11.1.1.6.0_disk1_1of1) into a any folder. Go to that “Disk 1” directory under the extracted folder and run the following command:

E:\softwares\OSB\ofm_osb_generic_11.1.1.6.0_disk1_1of1\Disk1>setup -jreLoc E:\InstalledSoftwares\jrockit

2. we have provided the JDK location in the above command

3. During the rest of the installation used the settings below

Installation location:

Oracle Middleware Home :E:\InstalledSoftwares\oracle\fmw11116\

Oracle Home Directory: Oracle_OSB1

Installation Type: Custom (ensure that ORACLE BUS IDE is selected).

Note the following in “Typical”. If the version is not matched it would say weblogic version is not compatible with OSB IDE. Then in “CUSTOM” you won’t be able to select the ORACLE BUS IDE. This means that weblogic which is selected is of different version say 11.1.1.4 and OSB_GENERIC is of different version say 11.1.1.6

Prerequisite Checks – This stage passes

Product Home Location:

Weblogic Server Location: / E:\InstalledSoftwares\oracle\fmw11116\wlserver_10.3

OEPE Location E:\InstalledSoftwares\oracle\fmw11116\oepe-indigo11.1.1.8.0_64

Note the following: The OEPE location is automatically taken. Suppose if OEPE version is not compatible with OSB , then OEPE will not get recognized. You will get message as “OEPE” location is invalid even if you manually select the OEPE. So in this example OEPE should be 11.1.1.8 and OSB should be 11.1.1.6

Step5: Verify the OSB IDE

Check if OSB IDE has been installed or not

Open the eclipse ide from the below location

E:\InstalledSoftwares\oracle\fmw11116\oepe-indigo11.1.1.8.0_64

Set the workspace to any folder

Check the following

Window->open perspective->other->Oracle Service bus

You should be able to see the Oracle Service bus

Step6)Configuring the OSB SERVER or creating the domain

a) Go to E:\InstalledSoftwares\oracle\fmw11116\Oracle_OSB1\common\bin

b) Config.cmd

c) Select new domain creation.

d) Select the configuration as shown below so that we get OWSM,EM etc

e) give the domain name as osb_domain

f) Give username as weblogic/welcome1

g) Select development mode

h) Give the databse details for OWSM MDS schema(ignore the failure test) and OSB JMS reporting provider

i) Proceed to next step(by pass the DB connection if it asks),

Step 7)Access the sbconsole

Go to the following location:

E:\InstalledSoftwares\oracle\fmw11116\user_projects\domains\osb_domain

And type the following

startWeblogic.cmd

Now access the sbconsole

http//localhost:7001/sbconsole

enter weblogic/welcome1

you should be able the see the screen

for more info. http://aleemkhan09.blogspot.in/2012/04/installing-osb-11116-with-osb-ide-on.html

Sunday, 22 June 2014

RESTful Services with Oracle Service Bus

Recently I was asked about REST (see http://en.wikipedia.org/wiki/Representational_State_Transfer)
support in Oracle Service Bus. OSB 10gR3 has full support for REST and
implementing a REST approach in a proxy service is very simple. In this
example, we will create a proxy service that provides a REST interface to a
product catalog.

Why use OSB for REST?

Using the Oracle Service Bus to provide an interface as
simple as REST may seem odd at first. There are several good reasons for this
approach though.
  1. You automatically get all of the monitoring, reporting, security and more provided
    by OSB for your RESTful services

  2. You keep the benefits of mediation. For example, of our company in this example
    purchased another company that provided different products, you could use the
    OSB to act as a façade over both product catalogs while providing a single,
    unchanged REST interface.

  3. You
    can REST-ify existing, non-service enabled assets like EJBs

The Products Proxy Service

Let's get started. First we will create a new OSB
Configuration Project to house our REST services. I named the configuration
project RESTConfig in the sample source code. You can download
the sample source code here.
Inside of the RESTConfig project I then
created a standard OSB project named SimpleREST. Once the OSB
project was created, I was ready to start creating my REST project.
Next I created a proxy service named Products.
I used the default endpoint URI of SimpleREST/Products but in a
production environment you'll most likely want to customize that. Be sure to
define your proxy service as an Any XML Service so you can accept
and return XML of any flavor.
Now it is time to create our message flow. Here is where
it gets interesting. One of the fundamental concepts in REST is the use of the
native HTTP methods to allow the service consumer to express their intent. The
specific HTTP methods that we are interested in are: GET, POST, PUT, HEAD,
OPTIONS and DELETE. In this example I don't make use of the TRACE method.
However, you will be able to add that to your projects easily after reading
this.
The handling of each of those methods is different, so we
begin our message flow with a Conditional Branch node (see figure 1). I added a
branch for each of the methods I was interested in. In the Conditional Branch
node I set the XPath field to ./ctx:transport/ctx:request/http:http-method/text()
and theIn Variable field to inbound. This is the equivalent to the XPath
expression $inbound/ctx:transport/ctx:request/http:http-method/text().
The text() operation at the end is important because I
want to deal with the method in its plain text form and not as an XML
expression.

image001.jpg
Figure 1 Standard OSB REST Pattern
When adding the branches it is important to enclose the
contents of the Value field in single quotes (Figure 2) to denote it is a
string value. If you forget this, you will get an error about an unbound XML
node when you run the proxy service because OSB will treat the contents of the
Value field as a variable instead of a string literal.
image002.jpg

Figure 2 Don't forget the quotes!
For each branch, add a pipeline pair and name it
appropriately, as shown in figure 1. Before we fill in the GET Pipeline with
the necessary logic, let's take a moment to decide how we want the HTTP GET method
to be handled. Ideally, we want to be able to point a web browser or other REST
service consumer to a URL like: http://localhost:7001/SimpleREST/Products/id=# to
retrieve a product representation by its ID. Since the proxy service is
listening at http://localhost:7001/SimpleREST/Products,
the remainder of the URL (i.e. the id=#) will be accessible in the message
flow as the relative-URI part of the $inbound variable.

The GET Method

Now that we know what the URL should look like for a GET,
we can fill in the logic. In the GET Pipeline (Figure 3) we will add two Assign
actions. The first Assign action will get the first part of the relative URL
(i.e. the id part). We won't do anything
with this part in this example, but you can use this technique to ensure that
the URL used had the correct format. The expression to use in the first Assign
statement is as follows:
fn:tokenize(data($inbound/ctx:transport/ctx:request/http:relative-URI),
'=')[1]

This expression will take the relative-URL value and
tokenize it using the '=' character, returning the first token. So if the
relative-URI is "id=27" this expression will return the "id" string. Why XPath
counts from 1 instead of 0 I don't know. Set the Variable field to attr and you are
done with the first Assign statement.
The second Assign statement is very similar to the first,
except we are retrieving the second part of the relative-URI. Its expression is
as follows:
fn:tokenize(data($inbound/ctx:transport/ctx:request/http:relative-URI),
'=')[2]

Set the Variable field to productID. In the sample code I include
a Log statement to output the contents of these variables to the console
image003.jpg

Figure 3 The GET Pipeline
In the Response Pipeline we will construct our response
message for the GET. We will just mock up a product document for this tutorial.
The following code snippet (which you will put into the Expression field
of the Replace action) shows the value that the Replace action will put into
the $body
variable, which is then returned to the caller.
<Product>
<ID>{$productID}</ID>
<Name>Foobar</Name>
<Price>19.99</Price>
</Product>

Listing 1 Constructing the response document
Set the XPath field to just a period (.) and be
sure to select the Replace Node Contents  radio button. If you deploy
the project you can test it using your web browser. Assuming your OSB server is
running on the default port 7001, you can use the following URL:
http://localhost:7001/SimpleREST/Products/id=2
Your web browser should show you the following:
<Product>
<ID>2</ID>
<Name>Foobar</Name>
<Price>19.99</Price>
</Product>

Note: Capitalization counts even with REST
Alternatively, you can use the OSB Test Console instead of
a web browser. I recommend using the Test Console (Figure 4) because it gives
you more control over the service call and visibility into the message flow. To
test the GET method, right-click on the Products.proxy file in the
Workshop IDE and select Debug As -> Debug on Server.... When the Test
Console appears, click on the down-arrow icon in the Transport section. This
will allow you to set the relative-URI and http-method fields directly.
image004.jpg

Figure 4 The Transport section of the Test Console
When you are happy with your settings, press the Execute
button to run the test. The Test Console (Figure 5) will return the results and
provide you with the response metadata and the invocation trace, which is
useful when debugging your proxy services.
image005.jpg
Figure 5 The Test Console response
Now that we have the GET branch taken care of. Let's take
a quick look at the other HTTP methods that we are supporting.

The POST Method

The HTTP POST method is traditionally used with REST to
create new entities. The message content that is POSTed can be in XML format, or
in the format used by HTML forms, which is still the most common mechanism for
submitting data to a web site in use today. However,, I highly recommend that
you keep your information in XML format instead of the HTML Form format simply
because the HTML Form only  supports the GET and POST verbs, whereas with REST
we also want to use the other verbs, like PUT and DELETE.
The POST Pipeline shows how to handle the POST method. It's
pretty simple in that it extracts the specific information it wants from the
$body and then creates and returns an XML representation, simulating the
creation of a product. You can use the OSB Test Console to test this method by
setting the http-method field to post and then typing in the payload as
follows:
<Product>
<Name>Widget</Name>
<Price>99.99</Price>
</Product>

The two Assign statements in the POST Pipeline simply
extract the name and price information and return a representation of the new
product, with a hard-coded ID of 777

The PUT Method

The PUT method is used to update an entity. It operates
very much like the POST method does, except this method will expect to see the
ID in the submitted product representation. You can test this operation in
pretty much the same way that you tested the POST, just change the http-method
to PUT and use the following as your payload:
<Product>
<ID>999</ID>
<Name>Widget</Name>
<Price>99.99</Price>
</Product>

Here we will add a little error checking to ensure that
the ID for the product has been specified. The If-Then action (Figure 6) uses
the expression: exists($body/Product/ID) to test
for the presence of the ID element.
image006.jpg

Figure 6 The PUT Pipeline
If the ID element is defined, we then use a single Assign
statement to create our entire response document as follows:
<Product>
<ID>{$body/Product/ID/text()}</ID>
   <Name>{$body/Product/Name/text()}</Name>
   <Price>{$body/Product/Price/text()}</Price>
</Product>

If the ID element is missing from the $body, then we throw
an error to alert the service consumer of the problem. In the response pipeline
we simply set $body
to the value of $responseDoc, what was created in our Assign statement.

The HEAD Method

The HEAD method is used to return metadata about a
representation to the caller. It's called the HEAD method because the metadata
is returned in the HTTP headers. This metadata can be anything you want it to
be, but a good place to start is the standard HTTP headers used by the
Inbound-Response to the Inbound-Request. Figure 6 shows the message flow for
HEAD Pipeline (Figure 7). All we do is populate the data of a single Transport
Header action in the response pipeline.
image007.jpg
Figure 7 Implementing the HEAD method
Its up to you and your specific needs to define which
headers you want to send back for the HEAD method, but I recommend sending at
least the HTTP Content-Type header with a value along the lines of 'text/xml; charset=utf-8'.
This will help the HTTP clients know how to parse the text that is returned.
Setting the Connection header to 'keep-alive' is also generally a good idea.

The OPTIONS Method

Finally, the OPTIONS method is used to convey to the
caller which HTTP methods are appropriate for the Products entity. In this
case, all we need to do is to specify a Transport Header for the outbound
response (see figure 8).
image008.jpg
Figure 8 Implementing the OPTIONS Pipeline
Configure the Transport Header as shown in figure 9.
image009.jpg
Figure 9 Transport Header Settings
The expression for the header is 'GET, HEAD, PUT, DELETE, OPTIONS'. It
may not be necessary to add the OPTIONS clause, since you have to call it in order to get
the response in the first place, but I show it for completeness. That covers
the basics of using OSB to implement RESTful service patterns. As you can see,
it's quick and simple to do. Using this technique you can wrap any
functionality in your enterprise using a REST service interface.

The DELETE Method

The DELETE method is very straight forward. It expects to
have a product ID specified on the URI and it simply deletes the product with
that ID. Due to its trivial nature, it is not implemented in the sample code.

Calling RESTful Services from OSB

In addition to providing a REST interface, OSB can also
invoke REST services. For this part of the exercise we will provide a standard
SOAP interface to OSB. OSB will then take those SOAP calls and invoke the REST
services accordingly. The WSDL for our SOAP interface defines the following
operations:
getProductDetail(productID)
createProduct(name)
updateProduct(productID)
deleteProduct(productID)

Each of these operations will be performed by the REST
services we created earlier in this tutorial.
We begin by creating a proxy service named CallREST based
on the Products.wsdl file (in the WSDL folder of the SimpleREST project). Since
the WSDL defines several SOAP operations, we start the message flow with an
Operational Branch node, and create branches for each of the operations we want
to handle. Once that is done, add a Pipeline Pair to the getProductDetail
branch, as show in Figure 10.
image010.jpg

Figure 10 The basic structure for the CallREST message flow
The getProduct Pipeline consists of a single Stage
node, as shown in Figure 11. The initial Assign statement is used to extract
the product ID from the request document and store it in the $productID
variable. The next node is a Service Callout
image011.jpg

Figure 11 The getProduct Pipeline stage
The Service Callout (Figure 12) is where most of the work
is done. To configure the Service Callout, be sure to check the Configure
Payload Document radio button since REST does not use a SOAP format. Set the Request
Variable
field to requestBodyDocument
and the Response Variable field to responseBodyDocument. That's all you need to do for the Service Callout action.
image012.jpg

Figure 12 Service Callout contents
The first action is a Transport Header. Configuring this
action is simple. Set the Direction field to Outbound Request.
Also, be sure to check the Pass all Headers checkbox.
Immediately after the Transport Header action are two
Insert actions. The first insert action (Figure 13) is used to specify the HTTP
GET method. Configure it as shown in Figure 13
image013.jpg

Figure 13 Specifying the HTTP GET method
The second and last Insert action (Figure 14) in the
request pipeline shows how to specify the relative-URI of the request. The expression:
<http:relative-URI>id={$productID}</http:relative-URI>
is used to create the value of the relative-URI of the outbound request
variable.
image014.jpg

Figure 14 Specifying the Relative-URI of the request
At this point our request of the REST service is properly
formatted. Once the REST service is invoked, the response will be returned to
our message flow in the responseBodyDocument
variable. In the Response Action pipeline of the service callout, we add a
single Replace action (see Figure 15) to take the response document from the
REST service and format it to meet the needs of our SOAP operation.
image015.jpg

Figure 15 Formatting the <body> that our operation returns
The remaining branches follow a similar pattern so there
is no need to document them here. If you want to see the sample code for this
blog entry, you can download it from here:
Download Source

Conclusion

As you can see from this sample, it is very easy to use
Oracle Service Bus to both call existing REST services, and to have OSB provide
a REST interface to existing SOAP services. The benefit of REST is the
simplicity of the interface design. By marrying OSB and REST, you get the
simplicity of REST, while maintaining the ability to define SLA's on each
service or operation, maintain visibility over these operations using OSBs
built in monitoring and reporting, and still retaining the necessary agility by
being able to quickly alter the OSB message flows and aggregating/orchestrating,
multiple services in the "backend" without the implicit knowledge of the
service consumer.


Reference  : https://blogs.oracle.com/jeffdavies/entry/restful_services_with_oracle_s_1

Sunday, 9 February 2014

Custome XQuery in OSB.

Custom XQuery Functions in OSB 11g
-----------------------------------
Oracle Service  Bus 11g version, offers an extensible framework for writing your own
XQuery functions and allows to use them in the OSB Message Flows

You can also specify the scope of these custom XQuery functions and where these
functions should be available in OSB - for example in Pipeline and Split-Join or only
under Pipeline

Steps for implementing the custom functions

1. Create an XML file
2. Create a properties file(optional). Keys wrapped in % symbols in the XML file gets
    the values from this properties file
3. Create your custom Java class and package it as a jar file

I have implemented the XQuery custom functions and you can find the following
resource files

1. osbCustomFunctions.xml
2. osbCustomFunctions.properties
3. customXPathFunc.jar

These three resources should be placed under "%OSB_HOME%\config\xpath-functions"
for the OSB to recognize the XQuery functions.

For example, in Windows OSB installation,
files are copied to "C:\beaplatforms\11g\wls1033\osb11g\config\xpath-functions"

Remember that for a Clustered Installation spanning multiple hosts, you should copy
these files to the location on each host machine

1. osbCustomFunctions.xml
--------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xpf:xpathFunctions xmlns:xpf="http://www.bea.com/wli/sb/xpath/config">
 <xpf:category id="%OSB_CUSTOM_XQUERY_FUNCTIONS%">
  <xpf:function>
   <xpf:name>customConcat</xpf:name>
   <xpf:comment>%FUNCTION_CUSTOM_CONCAT_COMMENT%</xpf:comment>
   <xpf:namespaceURI>http://test.org/osb/custom/functions/CustomXpathFunc
   </xpf:namespaceURI>
   <xpf:className>org.test.custom.CustomXpathFunc</xpf:className>
   <xpf:method>java.lang.String customConcat(java.lang.String, java.lang.String)
   </xpf:method>
   <xpf:isDeterministic>false</xpf:isDeterministic>
   <xpf:scope>Pipeline</xpf:scope>
   <xpf:scope>SplitJoin</xpf:scope>
  </xpf:function>
 </xpf:category>
</xpf:xpathFunctions>

2. osbCustomFunctions.properties
--------------------------------
%OSB_CUSTOM_XQUERY_FUNCTIONS%=Test OSB XQuery Custom Functions
%FUNCTION_CUSTOM_CONCAT_COMMENT%=Returns the concatenated string of the two input
string arguments

3. customXPathFunc.jar
-----------------------
Here is a simple Java Class with one method.
Compile the Java class, and create JAR file (customXPathFunc.jar)
The method returns a concatenated string of the two input strings and
appends "from Amsterdam"

package org.test.custom;
public class CustomXpathFunc {
 public CustomXpathFunc() {
 // TODO Auto-generated constructor stub
 }
 public static java.lang.String customConcat(String inputOne, String inputTwo){
 return "You are " + inputOne+ " "+inputTwo+ "from Amsterdam";
 }
}

Testing in Oracle Service Bus- SBConsole
---------------------------------------
Copy all the above files to the location "%OSB_HOME%\config\xpath-functions" and
restart your OSB Server.

Log onto the sbconsole: http://localhost:7001/sbconsole
Create a Proxy Service Message flow, and choose to edit an XQuery Expression

In the XQuery expression editor, you should now see the Custom XQuery function
under the XQuery functions in the Proxy Service Message Flow - XQuery expression editor

OSB XQuery Expression Editor is shown here

sbconsole-xquery-customXpath

You can also test the XQuery function

sbconsole-testpage

Reference:
http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/custom_xpath.htm

Monday, 30 December 2013

Enabling Transactions

REF : http://soa-osb-tech.blogspot.com/2013/11/transaction-handling-in-osb.html


1. Make sure the source JMS transport URI is using an XA enabled Connection Factory.

2. In Proxy Service Configuration –> JMS Transport –> Advanced Settings –> Check Is XA Required
3. In Proxy Service Configuration –>Message Handling Configuration –>CheckTransaction Required.
This will instruct the underlying OSB JMS Transport to start a transaction before executing the proxy service code. The transaction will be committed/rolled back based on how the proxy service code executes.
Committing transaction on non-recoverable exception
1. Transaction will commit implicitly if proxy service code executes successfully.
2. In case of error and if proxy flow enters an error handler , the transaction can still be committed by using a reply action ( “Reply With Success” or “Reply with Failure”)

It can look contradicting that a reply with failure action can in fact commit a transaction, but that’s how it works!

Request Transaction Manager to rollback the transaction

A transaction can be marked to be rolled back by the transaction manager by allowing an error to propagate all the way up to the system error handler.

OSB’s error pipeline can consist of either of the following sequence :
  • Route Error Handler –> Service Error Handler –> System Error Handler (Comes into picture when an error occurs in a route node)
  • Stage Error Handler –> Pipeline (request or response) Error Handler –> Service Error Handler –> System Error Handler (Comes into picture when an error occurs in a stage).
If a particular error handler is not present the error is propagated to the next available parent in the chain until it reaches system error handler. This propagation can be stopped by using a ‘reply’ action in any of the error handlers. The developer can mark a transaction to rollback by allowing an error to propagate all the way to the system error handler byNOT configuring a reply action in any of the intermediate error handlers.
Enlist the target business service within the same transaction
1. The target business service to which the message is routed (using Route Node) or published (using Publish Action) can be enlisted within the same transaction. For this the business service endpoint should be transactional i.e. if JMS should use a XA enabled connection factory.
2. Within the route node or publish action request action, set Quality of Service to “Exactly-Once” using a routing options action.

If the outbound transport is HTTP, there will be a design decision you will need to make on what type of errors to be marked for rollback. OSB’s HTTP transport commits all transaction if it gets a HTTP response code back from the server. So even if it gets a 404 Page Not Found or 500 Internal Server Error , HTTP transport doesn’t mark the transaction for rollback. This will result in message loss if the target service is frontended by webservers. You will get a http error back from the webserver even if the backend app servers hosting the service is down. The transaction then gets committed as HTTP transport didn’t mark it for rollback.
On the other end if you are sending a faulty message and service keeps on returning a soap:Fault which will be returned with a HTTP response code of 500, this will be non retriable fault and you would want to commit the transaction after publishing to an error destination. As noted before this is a designer decision to be taken depending upon your error handling requirements.
To override the default behaviour and make the HTTP transport commit the transaction only on receiving a success response from server ( HTTP response code 200 or 202) , make sure you check the ‘Same Transaction for Response’ checkbox.

Routing,Publish and Service Callout

When you are first starting with OSB it can be a little tricky to determine when to use a Route, Service Callout or a Publish node.  All three can be used to call either a Business service or a local Proxy service.  You can use the following lists to determine which will best fit your needs.

Route

    Last node in request processing.  It can be thought of as a bridge between request pipeline processing and the response pipeline processing.
    You can only execute one route in your Proxy Service.
    Can only be created in a route node.
    OSB will wait for the Route call to finish before continuing to process.
        If you are calling a Business service and you specify Best Effort for QoS (Quality of Service), then OSB will release the thread it is holding while the business service executes.
        If you are calling a Business service and you specify Exactly Once or At Least Once for QoS, then OSB will hold onto the thread while the business service executes.
        If you are calling a local Proxy service, then OSB will hold onto the thread until the Proxy service finishes executing.

Service Callout

    Can have multiple Service Callout nodes in a Proxy service.
    Pipeline processing will continue after a Service Callout.
    Can be invoked from the request and/or response pipelines.
    Used to enrich the incoming request or outgoing response. For example, a call to get a country code.
    Used for real time request/response calls (Synchronous calls).
    OSB will hold a thread and not continue until the Service Callout completes.
    Can tie up resources and degrade performance under heavy loads.

Publish

    Can be synchronous or asynchronous
        If you are calling a business service with a Quality of Service of Best Effort , then it will be an asynchronous call.
        If you call a business service with a Quality of Service of Exactly Once or At Least Once, OSB will wait until the processing completes in the business service completes before proceeding and it is effectively a synchronous call.
        If you are calling a local proxy service, OSB will wait until the processing in the local proxy service completes and it is effectively a synchronous call.
    Can be invoked from the request and/or response pipelines.
    Best to use when you do not need to wait for a response from the process you are calling (Fire and Forget.... Asynchronous Calls)

Difference between $body variable and other variable in osb

As I am new to the OSB , I got stuck with this problem while developing an interface in my current project. My objective was to capture a unique ID from incoming SOAP request message. My SOAP request message is as follows

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" xmlns:ahs=http://www.siebel.com/xml/SampleUpDispSt>
  <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <cus:SampleUpDispStInput xmlns:cus="http://siebel.com/CustomUI" >
      <ahs:ListOfSampleUpDispSt xmlns:ahs="http://www.siebel.com/xml/SampleUpDispSt">
        <ahs:Action>
          <!--Optional:-->
          <ahs:ProjId>1-2N94XX</ahs:ProjId>
          <ahs:CompletedDate>12/07/2011</ahs:CompletedDate>
          <ahs:Status>Assigned</ahs:Status>
        </ahs:Action>
      </ahs:ListOfSampleUpDispSt >
    </cus:SampleUpDispStInput>
  </soapenv:Body>
</soapenv:Envelope>


 

My Objective is to capture the ProjId value from the SOAP message. So I have created a variable to capture the <soapenv:Body> value and using an assign activity I have captured the entire body value in that variable. My Assignment statement xpath is “$body” and I have used a variable named “varResponseBody” image
I was surprised at next step when while trying to capture the <ahs:ProjId> value from $varResponseBody using an Assign activity. The Xpath was given as “$varResponseBody/cus:SampleUpDispStInput/ahs:ListOfSampleUpDispSt/ahs:Action/ahs:ProjId/text()”. Because my understanding was as I have copied the “body” variable in “varResponseBody” it would have everything as the body variable has, which was correct because as per our testing in OSB console to print the “varResponseBody” it gives us below output.
image




But I was unaware of the fact that the difference lies in the context of $body and $varResponseBody . Please find below snapshot.
image


image
 

image
 


So If we are trying to capture ProjId value based on $body then the xpath will be “$body/cus:SampleUpDispStInput/ahs:ListOfSampleUpDispSt/ahs:Action/ahs:ProjId/text()” and If we are trying to capture ProjId value based on $varResponseBody then the xpath will be  “$varResponseBody/ahs:ListOfSampleUpDispSt/ahs:Action/ahs:ProjId/text()”





ref : http://soa-osb-tech.blogspot.com/2013/05/difference-between-body-variable-and.html