Monday, December 9, 2013

Setting A Timeout For A Web Service in SOA Suite 11g


This post explains how to set a TIMEOUT for a  Web Service invocation when using SOA 11g .

This applies to both BPEL and Mediator and can be used when only the Web Service invocation is made through HTTP. 


1. For a process that invokes a Web Service, we want to set a timeout of maximum 10 seconds that the SOA application will wait for the answer. If no response is received within the specified timeout, then we want to catch the timeout error and perform a series of other activities.

The sample below is for a BPEL in a SOA Composite - it will work the same way with Mediator as the timeout is set in composite.xml file and not in some specific BPEL file .

2. Let's say the SOA composite looks like this:

3. Click on  "Service1" and note that the property inspector will open in the lower right side of your JDeveloper window. Here set the property :

oracle.webservices.httpReadTimeout = 10000

If the Web Service is on the same domain as the SOA Composite , we need have to set 

oracle.webservices.local.optimization = false

By default the local optimization is TRUE and when a SOA composite invokes another SOA composite within the same Weblogic (WLS) server or cluster of WLS servers bypasses the whole SOAP stack, and makes a direct java call to optimize the invocation.

You may set these properties directly in composite.xml as follows :

4. In the BPEL process we can add a Catch branch for a RemoteFault if wewant to catch this error . 

5. Now deploy the composite and run it from EM page . The Web Service we are calling takes 30 seconds to complete , but we set the timeout to 10 seconds - note that the Remote Fault occurs after 10 seconds.

6. Other way is the BPEL only, it's possible to use "Timeout" option for Invoke or Receive activities.Note when using this parameter it will return a "bpelx:timeout" Fault, and not a Remote Fault

Wednesday, January 23, 2013

For Each Action In OSB

I was replying to OTN  forum post regarding OSB For each action at :

So thought of writing it down to make it more clear.....

  1. I have made xml based proxy service.

2. I assumed the payload would be 


3. Assigned $body to companycollreq ( user defined variable) using Assign action
4. To keep a count of companycollection elemennt in the  request payload
   Assign count($companycollreq/request/CompanyCollection) to  companyCount

5. Now use a for each action to iterate over companycollection
    For each expression would like as:
   For Each variable companycoll   in ./request/CompanyCollection of variable  companycollreq 
   Indexed by variable currIndex with total count in variable  companycount

6.  Under Do 
      I am logging the companycollection element based upon the currindex count in for loop.
      This is important as we need to pass payload under iteration in for loop. 

     Assign $companycollreq/request/CompanyCollection[xs:int($currIndex)] in log action with annotation 
     of companycoll

Now Testing is done with above payload.

In Console logs obtained:

This is how for each action works.
Log action runs twice as companycollection count was two in payload passed.
In place of log action we can use service callout/Publish/Java callout .
The payload passed must contain currIndex as xquery predicates expression while passing value to other services being called from for loop.

Monday, December 17, 2012

External Table Names column getting hang up while creating data objects in BAM

Problem : 

Creating data source using using Oracle EBS Database as external tables then BAM Web Application is getting hanged up!!
Steps to replicate :

1. We are using Oracle EBS R12 database as external datasource in BAM. This is done perfectly using BAM Architect -- External Datasources

2. Now While creating Data Objects and selecting above created external(refering to EBS database) data source then external table names.. are not coming up and its keep on processing and getting hanged up !!

Error : 

I tried increasing the socket time from 600 to 26000 in weblogic and BAM server. But had no luck !!

Solution : 

As suggested by Oracle Support 


I have tried replicating the issue but in my case for the first time it took several minutes when I selected external data object and selected datasource from the drop down list. I believe this is not a BUG but dependent on performance.


Problem occurred as result of performance and hardware issue .

I was  connecting eBS and SOA Suite ( which are located in different location/environment) and were not in same DMZ and I was connected to Oracle EBS instance over VPN connection too !!

Friday, December 14, 2012

Timed out when making request to XAResource

Error Log Trace :

[2012-09-11T19:58:01.053+05:30] [AdminServer] [ERROR] [] [oracle.soa.adapter] [tid:$WorkWithListener@1d4729d] [userId: <anonymous>] [ecid: 0000Jap5w7iCSs05Rz^Ayd1GJm2d000002,0] [APP: soa-infra] weblogic.transaction.RollbackException: Transaction has timed out when making request to XAResource 'EBSDS_base_domain'.[[
javax.resource.ResourceException: weblogic.transaction.RollbackException: Transaction has timed out when making request to XAResource 'EBSDS_base_domain'.atoracle.tip.adapter.fw.jca.messageinflow.MessageEndpointImpl.afterDelivery($AQDeliveryBean.afterOnMessage($AQDeliveryBean.access$100(

Reason :

oracle.soa.adapter : indicates the error had resulted from JCA Adapter .

 XAResource 'EBSDS_base_domain :   EBSDS is datasource being used to make  database connection to EBS Suite( in my case ) for  base_domain.

JDBC datasource was not able connect to database with which it was configured at design time.

Solution : 

Try to check if the database in being up or down with help of Toad or Oracle SQL Developer.
Or Try to make new JDBC DataSource in Weblogic console using the same same database name, hostname, port, password  and try to test the connection.

ConnectionDeadSQLException & common.ResourceException

Error Log Trace:
internal Exception: weblogic.jdbc.extensions.ConnectionDeadSQLException: weblogic.common.resourcepool.ResourceDeadException:0:weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: IO Error: The Network Adapter could not establish the connection.

The DB Service went down abrublty as This exception is generated when an application request to get a connection fails because the connection selected to be returned to the application from the pool fails the configured tests.
Weblogic tests a connection before it is given to a client.

Solution : 

Oracle DB Service need to be restarted !!

Monday, February 6, 2012

OSB Clustering & Load Balancer

OSB clustering is being used to run multiple servers in parallel and to provide failover in case any managed server fails. Load Balancer is being used to effectively distribute the request payload among the running managed server in cluster depending upon the algorithm being used ( by default round robin ).

I will make use of Software Load Balancer (HTTP proxy servlet ) inbuilt in weblogic server as the implementation is being is done to simulate in clustering and load balancing in development or testing environment for the HTTP requests.
For production environment Hardware Load Balancer like BIG IP  ..are being used.

Architecture would be like :

 1. Domain Creation

    2.  Do Select Oracle Service Bus and not OSB for developer's




    7. Add managed server ip and port no in cluster address  (,

    8. Add only osb1 & osb2 to osbcluster

    9. Add the third managed server as Proxy server 


    11.Add all to machine 

    12.  Finished the setup and start admin server.

    13. Start managed server osb1

    14. Start managed server osb2

    15. Start managed server lb (load Balancer) 

    16. Go Service Bus Console and check the server health 

    17. Load a wsdl and make a proxy on it, add a log action( to check which managed server the request is going ) to capture the request payload and do reply with success 

    18. Go to weblogic console to check the clustering setup  : 

     Go to deployments under weblogic home, you will find the encircled app which is handling the load      balancing 

    19. Just enter 
                        http://[managed server ip address]:[managed server port no]/yourproxyurl?wsdl   
    You will find a wsdl published but have endpoint pointing to loadbalancer ip and port no 

    20. Now i have used soap-ui to test the load balancing 

    My request would be hitting load balancer  and load balancer would be handling the distrubution among osb1 and osb2 

    keep a look in the endpoint being hit in soap-ui 

    First time the request has gone to osb1 as we can see in logs of osb1 managed server 

     b: I again tested it from soap-ui then the request would go to osb2 as we can see in logs of osb2 managed server (green)

    • If you shutdown admin server, still the request can be fulfilled by osb1 and osb2 . 
    • If any of osb1 or osb2 is down then request would be re-directed to running managed server either osb1 or osb2.
    • If you shutdown load balancer managed server (lb) then request won't be fulfilled you need to point your request to osb1 or osb2 by changing the endpoint                                                                                                http://[managed server ip address]:[managed server port no]/yourproxyurl.

    So the osb clustering and load balancing is achieved in simple manner !!

    Monday, January 9, 2012

    Adding namespace to XML Structure

    I came across a situation while doing CSV to XML transformation, the MFL action in OSB transforms CSV to XML or vice -versa but the resulted XML structure does n't have a namespace added to it.

    Namespace is required while doing service orchestration (by using Service Callout or Route action ).
    There are two ways u can add namespace to xml structure .

    1. Make a XSD of the xml structure and use Xquery transformation selecting newly created xsd of non-namespace as Source and in Target select as xsd/wsdl element which u want as result.

    2. We can use xquery to add a default namespace to xml structure.(which is obtained using mfl action and storing the result in variable named InputRequestXmlBody

    xquery version "1.0" encoding "Cp1252";
    (:: pragma parameter="$noNamespaceXML" type="xs:anyType" ::)
    (:: pragma parameter="$namespaceURI" type="xs:string" ::)
    (:: pragma type="xs:anyType" ::)
    declare namespace xf = "";

    declare function xf:addNamespaceToXML($noNamespaceXML as element(*),$namespaceURI as xs:string) as element(*)
    element {fn:expanded-QName($namespaceURI,fn:local-name($noNamespaceXML))}
    for $node in $noNamespaceXML/node()
    if (exists($node/node())) then xf:addNamespaceToXML($node,$namespaceURI)
    else if ($node instance of element()) then element {fn:expanded-QName($namespaceURI,fn:local-name($node))}{$node/@*}
    else $node }

    declare variable $noNamespaceXML as element(*) external;
    declare variable $namespaceURI as xs:string external ;
    xf:addNamespaceToXML($noNamespaceXML, $namespaceURI)

    We can use replace action then to add namespace to xml structure .

    So XML Structure like this :


    would end up like this :
    <req:Transaction xmlns:req="http://in.abhinav/schema/request">

    Happy Flows !!