How to Set a Timeout for a Web Service in SOA 11g ?

In 11g SOA we don't have anymore the "Timeout" property that we can put in Web Service invocations to set a maximum wait time in a sync BPEL invocation - so the solution presented in Setting a Timeout for a WebService invocation in BPEL will not work anymore in BPEL 11g.

I will explain below how to set a TIMEOUT on a Web Service invocation when using SOA 11g . This can only be used when only 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   (in MiliSeconds)

If the Web Service is on the same domain as the SOA Composite , you will also 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 

<reference name="Service1"
ui:wsdlLocation="http://localhost:8001/soa-infra/services/default/Child!1.0/Child.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/test/Child/Child#wsdl.interface(Child)"/>
<binding.ws port="http://xmlns.oracle.com/test/Child/Child#wsdl.endpoint(child_client_ep/Child_pt)"
location="http://localhost:8001/soa-infra/services/default/Child!1.0/child_client_ep?WSDL">
<property name="oracle.webservices.local.optimization">false</property>
<property name="oracle.webservices.httpReadTimeout" type="xs:string" many="false">10000</property>
</binding.ws>
</reference> 
 
4. This timeout will throw a RemoteFault - so you can easily add a Catch to your BPEL code to catch this error.

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


 

Posted in Labels: , , | 4 comments

How to Define Transaction Timeout for BPEL on Weblogic ?

Consider following scenario : you want to force a BPEL to wait for maximum of 3 (180 seconds) minutes to get reply from a Partner Link.  You can set the following timeouts :
a) syncMaxWaitTime to 180;
b) for CubeEngineBean, CubeDeliveryBean and MessageBean to 240 (best is to set it 1-2 minutes more than the syncMaxWaitTime)
c) Global JTA Timeout to 300

As a general rule, you should have following relation between the timeout parameters:

syncMaxWaitTime < BPEL MBean transaction timeout < Global Transaction Timeout

 1. Setting the global transaction timeout on Weblogic domain level :
  • Login to Weblogic console (http://host:port/console);
  • Select Services > JTA from the left pane;
  • Select JTA tab in the right pane;
  • Change the parameter:
    Timeout Seconds  (specifies the time in which a transaction will timeout, if uncommitted);
All steps described above can be done by editing directly BEA_HOME\user_projects\domains\SOADomain\config\config.xml and changing the value in section:

<jta>
<timeout-seconds>300</timeout-seconds>
</jta>

2. Setting the transaction timeout for BPEL application in the deployment descriptor :
  • Go to BEA_HOME\user_projects\apps\soaApps\BPELPM;
  • Make a backup of ejb_ob_engine.jar (if anything goes wrong just put back the original ejb_ob_engine.jar);
  • Open the ejb_ob_engine.jar (for example in WinZip) and edit weblogic-ejb-jar.xml ;
  • Change the for the following MBeans : CubeEngineBean, CubeDeliveryBean and MessageBean;
    Save weblogic-ejb-jar.xml and repack the JAR (this is done automatically in WinZip);
  • Go to Weblogic Console -> Deployments and Lock&Edit;
  • Select BPELPM and Update it -> this will force a redeployment of the JARs;
  • Click Activate Changes (at this steps there might be some errors in Weblogic Console
    but afternext there will be no problems);
  •  Stop the SOA server and start it again;
  • After SOA server is started go to Deployments section and check if BPELPM is "Active". If not just start it from here by selecting and and cliking on "Start -> Servicing all requests".
3. Setting syncMaxWaitTime:

  • This property sets the maximum time the process result receiver waits for a result before returning;
  • Can be changed via BPEL Console -> Manage BPEL Domain (10.1.3.3) / Configuration (10.1.3.4);
  • Scroll down to find syncMaxWaitTime parameter. Change the parameter setting and click 'Apply' in lower right corner of the screen;
Related post about how to Set a Timeout for a WS invocation in BPEL

Posted in Labels: , | 3 comments

SOA 11g Book

New book on SOA 11g written by Oracle SOA Suite Product Management team is now available:
"Getting Started with Oracle SOA Suite 11g - A Hands-On Tutorial"

Posted in Labels: , | 0 comments

SOA 11g Samples

In SOA 11g the samples are not anymore in the install kit as were in 10g release, instead all samples are now posted on OTN for download.

SOA Suite 11g
Samples -- http://www.oracle.com/technology/sample_code/products/soa/index.html

BPEL 11g Samples -- http://www.oracle.com/technology/sample_code/products/bpel/index.html

Human Workflow 11g Samples -- http://www.oracle.com/technology/sample_code/products/hwf/index.html

Posted in Labels: , , | 1 comments

Deploy EAR or RAR using admin.jar

When trying to deploy an EAR or RAR using "admin.jar" you may get following error

WARNING: Exception returned by remote server: {0} javax.naming.NoPermissionException: This operation was denied. The admin.jar utility can not be used to perform operations against OPMN managed OC4J i nstnaces. Please use Enterprise Manager instead. Refer to the Oracle10iAS Admin Guide or the OC4J User's Guide for more details.

To have an example, let's say you just want to deploy RuleAuthor to a standalone oc4j container :

java -jar admin.jar ormi://localhost:12401 oc4jadmin welcome1 - bindWebApp ruleauthor ruleauthor default-web-site ruleauthor

and you get the error above.


Solution is to add the paramters
-DOPMN=true -Doracle.home=
in the command line

java -DOPMN=true -Doracle.home=/home/oracle/product/10.1.3. 1/OracleAS_1 -jar admin.jar ormi://localhost:12401 oc4jadmin welcome1 - bindWebApp ruleauthor ruleauthor default-web-site ruleauthor

and the deployment will work

[ 2009-04-01 11:37:12.901 BST ] Application Deployer for ruleauthor STARTS.
[ 2009-04-01 11:37:12.921 BST ] Copy the archive to /home/oracle/product/10.1.3
.1/OracleAS_1/j2ee/home/applications/ruleauthor.ear
[ 2009-04-01 11:37:12.945 BST ] Initialize /home/oracle/product/10.1.3.
1/OracleAS_1/j2ee/home/applications/ruleauthor.ear begins...
[ 2009-04-01 11:37:12.946 BST ] Unpacking ruleauthor.ear
[ 2009-04-01 11:37:12.997 BST ] Done unpacking ruleauthor.ear
[ 2009-04-01 11:37:12.999 BST ] Unpacking ruleauthor.war
[ 2009-04-01 11:37:13.299 BST ] Done unpacking ruleauthor.war
[ 2009-04-01 11:37:13.306 BST ] Initialize /home/oracle/product/10.1.3.
1/OracleAS_1/j2ee/home/applications/ruleauthor.ear ends...
[ 2009-04-01 11:37:13.307 BST ] Starting application : ruleauthor
[ 2009-04-01 11:37:13.307 BST ] Initializing ClassLoader(s)
[ 2009-04-01 11:37:13.319 BST ] Initializing EJB container
[ 2009-04-01 11:37:13.320 BST ] Loading connector(s)
[ 2009-04-01 11:37:13.340 BST ] Starting up resource adapters
[ 2009-04-01 11:37:13.351 BST ] Initializing EJB sessions
[ 2009-04-01 11:37:13.352 BST ] Committing ClassLoader(s)
[ 2009-04-01 11:37:13.352 BST ] Initialize ruleauthor begins...
[ 2009-04-01 11:37:13.358 BST ] Initialize ruleauthor ends...
[ 2009-04-01 11:37:13.359 BST ] Started application : ruleauthor
[ 2009-04-01 11:37:13.362 BST ] Application Deployer for ruleauthor COMPLETES.
Operation time: 461 msecs

Posted in Labels: , | 1 comments

10.1.3.5 Patchset

Oracle Application Server 10.1.3.5 patchset has been released for Windows and Linux platforms.

Patchset is available on Metalink as patch number 8626084.

Posted in Labels: , | 0 comments

RUL-01726 when Defining new Pattern in a Rule

After importing XMLFacts from an XSD, you try to create a new Pattern for a new Rule by comparing a Double (java.lang.Double type) with a double value (e.g. 4.2) , and you get following error in RuleAuthor

'RUL-01726: Data type operator for <, at position 0: java.lang.Double

The reason is that xsd:double type from the XSD was transformed in Rules into the Java class java.lang.Double. When you try to compare it with a double value (e.g. 4.2), this raises an error as you cannot compare a Java Class with a double value.

In order to compare these two data types, you can use the following solution :

1. Go to Definition -> JavaFact and click on Create to create a new JavaFact
2. Expand java.lang tree and select the Double class
3. Click Import . At this moment you should also see a new JavaFact created and named
java.lang.Double
4. Now go to RuleSets -> Rules and try to create a New Pattern
5. Create a new pattern and before clicking apply select the "Advanced Test " option
6. Edit the expression and change it to
myValue.doubleValue() <>The solution is to use the doubleValue() method of the java.lang.Double class. This method returns the double value, so you can compare it now with a number.

Note: Same would apply for other types of variables. For example, if you get an error "java.lang.Integer <>

Posted in Labels: , | 0 comments

NullPointerException using HTTP Basic Authentication

If you try to use use HTTP Basic Authentication headers to invoke a secured Web Service in BPEL 10.1.3.4

<property name="httpBasicHeaders">credentials</property>
<property name="httpBasicUsername">your_username</property>
<property name="httpBasicPassword">your_password</property>

You may encounter a NullPointerException error ONLY if you use ports 80 or 443 :

<Faulthttp://schemas.oracle.com/bpel/extensionhttp://schemas.xmlsoap.org/soap/envelope/>
<faultcode>null:bindingFault</faultcode>
<faultstring>business exception</faultstring>
<faultactor>cx-fault-actor</faultactor>
<detail>
<summary>com.collaxa.cube.ws.wsif.providers.http.WSIFOperation_HTTP@c54b88 : Could not invoke 'process'; nested exception is: java.lang.NullPointerException</summary>
<detail>java.lang.NullPointerException</detail>
</detail>
</Fault>

The simplest workaround is to try to host your web-service on ports other than 80 (http) /443 (https).

The issue is fixed in MLR 8 for 10.1.3.4 - patch number 8372150.

Posted in Labels: , | 5 comments

Getting Started with SOA 11g

Some quick steps to get a working SOA 11g install with a 11g DB repository

Database Install

SOA 11g supports Oracle 10g and 11g database, with following version
- Oracle Database 10g (10.2.0.4 or later)
- Oracle Database 11g (11.1.0.7 or later)

Note: you should install the DB with AL32UTF8 character set, otherwise you will get a warning when you run RCU:

The database you are connecting is with non-AL32UTF8 character set. Oracle
strongly recommends using AL32UTF8 as the database character set.
(however, as per certification page of SOA this warning can be ignored)

For download page of DB 11g go to
http://www.oracle.com/technology/software/products/database/index.html

and next you need to upgrade to 11.1.0.7 using
Patch 6890831 11.1.0.7.0 PATCH SET FOR ORACLE DATABASE SERVER

Follow all the PRE and POST install steps from the patch 6890831 readme for a succesfull upgrade to 11.1.0.7.

SOA Certification

Make sure your OS meets minimum requirements as specified in
http://www.oracle.com/technology/software/products/ias/files/fusion_requirements.htm
and the certification page
http://www.oracle.com/technology/software/products/ias/files/fusion_certification.html

Run
# ulimit -n
to find the maximum file descriptors

If the descriptors value is 1024, then edit /etc/security/limits.conf to increase the descriptor limit,
for example to 4096 :

* soft nofile 4096
* hard nofile 4096

Run RCU (Repository Creation Utility)

Download it from here :
http://www.oracle.com/technology/software/products/middleware/htdocs/111110_fmw.html

Run the RCU (Repository Creation Utility) to create SOA Schemas .
If you let the default settings you will end up with following schemas
- DEV_SOAINFRA
- DEV_ORABAM
- DEV_ORASDPM
- DEV_MDS

Weblogic 11g

Download Weblogic 11g from OTN :
http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html

and install it :

chmod +x wls1031_linux32.bin
./wls1031_linux32.bin

Install Soa 11g

Download the SOA package from here :
http://www.oracle.com/technology/software/products/middleware/htdocs/111110_fmw.html

Run config.sh

Go to SOA_HOME/common/bin folder and run
./config.sh

If you let at previous steps (WLS and SOA) default settings you will have here:
- Domain name = base_domain
- At the configure JDK screen choose Development Mode for JDK and Production Mode to use JRockit
- In the JDBC config screens the schema names are those given to RCU above
- Don't select anything at Advanced Configuration Screen

Start the server

First start WLS admin server
MW_HOME/user_projects/domains/domain_name/startWebLogic.sh
and next start soa_server1 (and bam_server1 if you installed also BAM).
MW_HOME/user_projects/domains/domain_name/startManagedWebLogic.sh soa_server1

Open a browser window:

- To access the Administration Server console:
http://host:admin_server_port/console

- To access Enterprise Manager:
http://host:admin_server_port/em

by default port is set to 7001.

Jdeveloper 11g

Download JDev 11g (for Linux or Windows)
http://www.oracle.com/technology/software/products/jdev/htdocs/soft11.html

and also download "JDeveloper extension for SOA technologies" from here:

http://www.oracle.com/technology/products/jdev/101/update/fmw_products.xml

Install JDeveloper and open it. Select Help/Check For Updates, Install from local file.
Bowse to the location you saved "soa-jdev-extension.zip"
After Install completes restart JDeveloper and go to Help > About > Version tab to confirm that the SOA extension are installed.

Last step is to create a new connection in JDev and you are ready to test your first composite:

Go to View > Application Server Navigator, right-click the Application Servers and select "New Application Server" . Enter connection details -> the default port is 7001 and WLS domain "base_domain" (if you left unchanged the install defaults). When testing the connection you should see 8 of 8 succesful completed tests.


Reference documentation:

SOA Install Guide:
http://download.oracle.com/docs/cd/E12839_01/doc.1111/e13925/overview.htm#
SOA Quick Install Guide:
http://download.oracle.com/docs/cd/E12839_01/install.1111/e14318/qisoa.htm#
DB 11g Install Guide:
http://www.oracle.com/pls/db111/portal.portal_db?selected=11&frame=#essentials#

Posted in Labels: , | 3 comments

Missing in SOAP Header when Calling Secured WS

When calling Secured Web Service from BPEL there is an error received in logs and in Bpel Console :

<ERROR> <default.collaxa.cube.ws>
<WSIFInvocationHandler::invoke> Fault happened: exception during SOAP invoke: Missing
<wsse:Security> in SOAP Header; nested exception is:
javax.xml.rpc.soap.SOAPFaultException: Missing <wsse:Security> in SOAP Header

The partner link properties in bpel.xml are all set correctly to use WSSE headers :

<partnerLinkBinding name="crm">
<property name="wsdlLocation">crm.wsdl</property>
<property name="wsseUsername">user_name</property>
<property name="wssePassword">the_password</property>
<property name="wsseHeaders">credentials</property>
</partnerLinkBinding>

Error only occurs on 10.1.3.4 and on 10.1.3.3.1 MLR#14 or higher. Exact same BPEL process works fine on 10.1.3.3.0 and on 10.1.3.3.1 until MLR#13.

When passing the WS Security header through partnerlink the SOAP request can generate OASIS 2002 or OASIS 2004 compliant header. For this there was an aditional parameter introduced : wsseOASIS2004Compliant

Setting it to "false" (the default value in 10.1.3.4) generates OASIS 2002 compliant header :

<property name="wsseOASIS2004Compliant">false</property>

and setting it to "true" generates OASIS 2004 compliant header :

<property name="wsseOASIS2004Compliant">true</property>

SOLUTION --> You need to change the PartnerLink properties in bpel.xml and add wsseOASIS2004Compliant property and set it to true.

<partnerLinkBinding name="crm">
<property name="wsdlLocation">crm.wsdl</property>
<property name="wsseUsername">user_name</property>
<property name="wssePassword">the_password</property>
<property name="wsseHeaders">credentials</property>
<property name="wsseOASIS2004Compliant">true</property>
</partnerLinkBinding>



Posted in Labels: , | 1 comments

Alarms do not Expire

Sometimes, when the a BPEL process have a lot of Wait and onAlarm activities (or there are many BPEL instances running that use Wait or onAlarm) then some of the Alarms may not fire.

The BPEL engine makes use of Quartz in numerous ways, mainly for expiration of wait and onAlarm activities, but also for:

  • sending periodically "pings" to the dispatcher to flush out stranded messages
  • enabling polling for custom activation agents
  • scheduling execution of activities that need to be performed in the future (for example, mail receive activities).

In 10.1.x releases of BPEL, the number of Quartz threads can be tuned by changing the com.oracle.bpel.*.threadCount properties in ORACLE_HOME/bpel/domain/DOMAIN_NAME/config/resources-quartz.properties file.

BPEL uses Quartz to schedule expiration events for Wait and onAlarm activities, and the parameter that controls number of threads for this is com.oracle.bpel.expirationAgent.threadCount.

There is no specific formula for calculating it, as this is a parameter that would require some tuning to set it to the best value suitable for your environment. The default value is 10, and for start you can try to set it to 30 and test. If still the number is too low, you can try to further increase to 50 or a higher value. Be careful that setting it too high, will result in increased overhead, because too many threads are created.

Sample setting of expirationAgent in resources-quartz.properties:

# com.oracle.bpel.expirationAgent - schedules wait/onAlarm activities;
# this is the most heavily used agent in the system. If your flows
# typically have many wait/onAlarm activities and the total number of
# instances created is high, performance may suffer if the expiration agent
# thread count is not sufficient to handle the load. In worst-case not
# having enough threads to handle high incoming request counts may result
# in OutOfMemory errors as the number of scheduled tasks piles up.
#
com.oracle.bpel.expirationAgent.threadCount = 30

Posted in Labels: , , | 1 comments