Handling timeouts in WebService client
rohit.macherla Aug 20, 2008 9:55 AMHi all,
I have JBoss 4.2.2.GA version installed on a HP Unix machine. We have a WebService, say A, that calls another WebService, say B. When A calls B it usually takes a lot of time, say 3-4 minutes to respond. I would like to know where to configure the timeout value for the WebService client A.
I have increased the Transaction timeout of the transaction-manager MBean to 400 ( I guess it is in seconds). Still we don't find any improvement and we get a transfer-timeout error.
<!-- | The fast in-memory transaction manager. | Deprecated in JBossAS v4.2. Use JBossTS JTA instead. - -> <mbean code="org.jboss.tm.TransactionManagerService" name="jboss:service=TransactionManager" xmbean-dd="resource:xmdesc/TransactionManagerService-xmbean.xml"> <attribute name="TransactionTimeout">400</attribute> <!- - set to false to disable transaction demarcation over IIOP - -> <attribute name="GlobalIdsEnabled">true</attribute> <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends> <!- - Transaction Integrity Checking - -> <!- - Force a rollback if another thread is associated with the transaction at commit - -> <!- - <depends optional-attribute-name="TransactionIntegrityFactory" proxy-type="org.jboss.tm.integrity.TransactionIntegrityFactory"> <mbean code="org.jboss.tm.integrity.FailIncompleteTransaction" name="jboss:service=TransactionManager,plugin=TransactionIntegrity"/> </depends> - -> </mbean> --> <!-- JBoss Transactions JTA --> <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService" name="jboss:service=TransactionManager"> <attribute name="TransactionTimeout">400</attribute> <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute> </mbean>
Also, since we are developing the code in Java, we have found some of the following properties that are configured in our code :
timeout.TestTimeOut_Service service = new timeout.TestTimeOut_Service(); timeout.TestTimeOut port = service.getTestTimeOutPort(); ((BindingProvider)port).getRequestContext(). put("com.sun.xml.ws.request.timeout", 4*60*1000); ((BindingProvider)port).getRequestContext().put( BindingProviderProperties.REQUEST_TIMEOUT, 4*60*1000); ((BindingProvider)port).getRequestContext().put( BindingProviderProperties.CONNECT_TIMEOUT, 4*60*1000); ((BindingProvider)port).getRequestContext().put( "com.ibm.SOAP.requestTimeout", 4*60*1000); ((BindingProvider)port).getRequestContext().put( "org.jboss.webservice.timeout", 4*60*1000); ((BindingProvider)port).getRequestContext().put( "org.jboss.webservice.client.timeout", 4*60*1000); ((BindingProvider)port).getRequestContext().put( "org.jboss.ws.timeout", 4*60*1000);
where, the "TestTimeOut_Service" is the WebService name and the 'port' object is the WebService Port for the "TestTimeOut_Service". We are using NetBeans for developing. And this code change does not help us in increasing the timeout because the WebService A throws a transfer timeout at about 120 seconds almost always.
Please suggest a proper place where we can set the client timeout when calling other
webservices.
Thanks.