3 Replies Latest reply on Jan 21, 2009 4:38 AM by rohit.macherla

    Handling timeouts in WebService client

    rohit.macherla

      Hi 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.

        • 1. Re: Handling timeouts in WebService client
          asoldano

          To setup the client invocation timeout, you have to setup the client timeout property in the request context through your port instance; the timeout will be then be passed to the remoting layer:

          ((BindingProvider)port).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, timeout);
          


          • 2. Re: Handling timeouts in WebService client

            Hi,
            Is there any System Property which sets the client timeout?
            I have tested my src code with the following line ant it worked:

             ((BindingProvider) soapService).getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT, new Long(1000));
            


            My problem is that I have an application in production, and it's problematic to make a patch (adding the line above).
            Is there any System Property I can add which sets the client timeout?

            Thanks in advance.
            Best regards,
            Victor Batista

            • 3. Re: Handling timeouts in WebService client
              rohit.macherla

              Hi,

              I am not aware of the system property.
              I would just like to add that the following would also work :

              ((BindingProvider) port).getRequestContext().put(
              "org.jboss.ws.timeout",
              200 * 1000);


              Thanks Alessio Soldano.