Tuesday, September 22, 2009

TCP Tunneling in SOA Suite

Tcp tunneling is a technology by which you can see the messages that are exchanged

between the different services.These services can be bpel or any web services.By the

help of this technique you can find the xml message(SOAP message) that are

commmunicated between the services i.e the request and response message.In net you can

find so many tools however SOA Suite provide its own tool which we will see to know

its functionality.


Tcp tunnel works in a concept of a broker,it just insert a listener in between the

end to end service so that the request now goes via the listener.So as soon as the

request/response comes to lisntener it displays the data as well as forward it to

the end service for which it is targetted.

In case of synchronous bpel process we need to set only one listener because the transaction request/reply happens in a single transaction.however in asynchronous bpel process we should have two listener as there are two transactions one for request and one for reply.

We will be using the tcp tunneling provided by default in SOA Suite BPEL

Go to the following directory

SOA_HOME\integration\orabpel\bin\obtunnel.bat


You will get a screen like this



By default it listen on port 1234.YOu can add your listener from the admin page

as follows




Now in deployment descriptor (bpel.xml) of the flow for which we want to see the SOAP message we need to a parameter "location".

This will cause the end point to be changed that is now the request will not go directly to the end point url but will go through the tcp listener.

If you have the following entry in the bpel.xml

<partnerLinkBinding name="SomeService">
<property name="wsdlLocation">
http://localhost:port/orabpel/default/SomeService/SomeService?wsdl
</property>
</partnerLinkBinding>


then we will be adding following property in it

<property name="location">
http://localhost:1234/orabpel/default/SomeService
</property>

the port number will be the number of port which you have configured for linstening

so now your bpel.xml should have entry like this

<partnerLinkBinding name="SomeService">
<property name="wsdlLocation">
http://localhost:port/orabpel/default/SomeService/SomeService?wsdl
</property>

<property name="location">
http://localhost:1234/orabpel/default/SomeService
</property>
</partnerLinkBinding>


Now compile and redeploy the project.

Now invoke the service from bpel console and you can see the SOAP message in the TCP Monitor.


So this is how you can see the request and reply message in case of synchronous bpel process however in case of asynchronous bpel process we need to have one more listener for receiving callbacks.

Again create one more listener listening on another port say 5678

Now GO to following location

$ORACLE_HOME/bpel/domains//config/domain.xml

<property id="optSoapShortcut">
<name>SOAP local optimization</name>
<value>true</value>
<comment>

and change the value of property opt-soap-shortcut from true to false.

Its definition says

Turns on "short-cut" for local SOAP request; local SOAP calls are normally done via an internal call instead of sending a message through the SOAP stack.

The default behavior for the engine is to optimize all. To disable optimization specify a value other than "true" or "yes"

So the reason is clear we dont want the internal call we want it to route via a tcp channel so we are setting it to false.

Now go to BPELAdmin console and change the following property

soapServerUrl

to http://localhost:5678

Keep in mind you have specified the port number used for callback request.


The hostname and port for this URL should be customized to match the hostname of your system and the port of your HTTP gateway which in our case is 5678.

Now restart the Bpel server.Invoke a asynchronous process and see the callback request.

No comments: