2 Replies Latest reply on May 9, 2014 7:06 PM by Jordan Baucke

    Session Timeout vs. Request Timeout

    Jordan Baucke Newbie

      I have an installation of Jboss-As 7.1.1 that I'm making some long-running HTTP JAX-WS requests.

       

      It seems that the requests are timing out (not positive, but they fail) and I wanted to make sure I had the server configured correctly.

       

      I've found documentation that I can set my 'session timeout' via the web.xml as follows:

       

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://java.sun.com/xml/ns/javaee"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
       version="3.0">
      ...
      
       <session-config>
        <session-timeout>20</session-timeout>
       </session-config>
      </web-app>
      
      

       

      But I'm assuming that `session-timeout` is not a HTTP request timeout? Is this true? If so how do I change it?


        • 1. Re: Session Timeout vs. Request Timeout
          Frank Langelage Master

          As far as I know the session-timeout is for an idle web-session.

          The timeout for JAX-WS is something totally different.

          Just recently I found out how to increase the timeout for long lasting web service requests or even to disable the timeout:

          public static void modifyReceiveTimeout( final Object o )
          {
               Client client = ClientProxy.getClient( o );
               HTTPConduit conduit = (HTTPConduit)client.getConduit();
               HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
               httpClientPolicy.setReceiveTimeout( 0 );
               conduit.setClient( httpClientPolicy );
          }
          

           

          After getting port interface use the method above to change it:

              MailServiceWSI wsi = this.getPort( new QName( "http://core.ws.fn.mbisoftware.biz/", "MailServiceWSPort" ), MailServiceWSI.class );
              Helper.modifyReceiveTimeout( wsi );
          1 of 1 people found this helpful
          • 2. Re: Re: Session Timeout vs. Request Timeout
            Jordan Baucke Newbie

            Thanks Frank,

             

            Perhaps I'm not using a JAX-WS as I thought was the best way to describe it.

             

            Unless there is an invocation for all the classes annotated this way that I can attach the helper you described too?

             

            There is an @ApplicationPath defined in another class (which sets the proceeding path), perhaps I could add it here?

             

            package rest;
            import javax.ws.rs.ApplicationPath;
            import javax.ws.rs.core.Application;
            
            @ApplicationPath("/rest")
            public class restapplication extends Application
            {
            }
            
            

            My methods are defined as public classes, with @Path parameters, like so:

             

            @Path("/mycall/")
            public class BulkCreate {
              *
              * @param token
              * @param objects
              * @return
              */
             @SuppressWarnings({ "unchecked" })
             @POST
             @Path("/bulk/create")
             @Produces(MediaType.APPLICATION_JSON)
             @Consumes(MediaType.APPLICATION_JSON)
            public Response query(@QueryParam("token") String token, Object[] object){
              ...
            }
            }
            
            
            
            

            I don't know how one would define "this" type of call? I guess its a REST Call with RestEasy (with some query params)