4 Replies Latest reply on Apr 24, 2014 8:23 AM by Alessio Soldano

    WS-Addressing + decoupled responses + http conduit timeout

    Guzman Llambi­as Novice

      Hi guys!

       

      I trying to use WS-Addressing with decoupled responses and made an example using the http-conduit. The problem I have is that the response is sent several minutes (30 minutes) after the initial call, so a timeout occurs. I thought that the http conduit doesn't have a timeout and was a server waiting forever, but maybe I'm wrong. Could you clarify me this please?

       

      A timeout of 30 minutes is not desired so, is there a way to develop decoupled responses without using an http-conduit? for example, setting the wsa:replyTo in the config file or by code?

       

      here's my client's cxf.xml file:

       

      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:http="http://cxf.apache.org/transports/http/configuration"
             xmlns:jaxws="http://cxf.apache.org/jaxws" 
             xmlns:wsa="http://cxf.apache.org/ws/addressing"
             xsi:schemaLocation="
              http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
              http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
        
        <jaxws:client id="addressingClient" serviceClass="test.addressing.cxf.AddressingSample">
        <jaxws:features>
          <wsa:addressing addressingRequired="true" />
        </jaxws:features>
        </jaxws:client>
      
        <http:conduit name="{http://abitab.com.uy/servicios/addressing}AddressingSampleImplPort.http-conduit">
          <http:client DecoupledEndpoint="http://localhost:28080/AddressingEndpoint/AddressingEndpointServlet" />
        </http:conduit>
      </beans>
      

       

      thanks in advance

      Regards

      Guzman

        • 1. Re: WS-Addressing + decoupled responses + http conduit timeout
          Guzman Llambi­as Novice

          Hi guys!

           

          I found the following properties to set the Addressing headers and:

          1. Client sends correctly replyTo header
          2. Service responds correctly an http 202 to the client
          3. Service responds correctly to the replyTo address
          4. ReplyToEndpoint receives correctly the answer
          5. Client throws a timeout error

           

          any idea about this?

           

          here's the properties settings:

           

          AddressingSampleImplService service = new AddressingSampleImplService();
          AddressingSample port = service.getAddressingSampleImplPort(new AddressingFeature());
          
          BindingProvider bp = (BindingProvider)port;
          
          AddressingProperties props = new AddressingPropertiesImpl();
          EndpointReferenceType ref = new EndpointReferenceType();
          AttributedURIType wsaReplyToURI = new AttributedURIType();
          wsaReplyToURI.setValue(replyTo);
          ref.setAddress(wsaReplyToURI);
          props.setReplyTo(ref);
          
          AttributedURIType messageID = new AttributedURIType();
          messageID.setValue("urn:uuid:"+UUIDGenerator.generateRandomUUIDString());
          props.setMessageID(messageID);
          
          bp.getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, props); 
          
          

           

          I also removed the http-conduit from the cxf.xml

           

          thanks in advance!

          Guzman

          • 2. Re: WS-Addressing + decoupled responses + http conduit timeout
            Alessio Soldano Master

            Guzman,

            if you haven't already, consider looking at http://anonsvn.jboss.org/repos/jbossws/stack/cxf/tags/jbossws-cxf-4.3.0.Final/modules/testsuite/cxf-tests/src/test/java/… (a testcase on WS-Addressing with decoupled endpoints too)

            1 of 1 people found this helpful
            • 3. Re: Re: WS-Addressing + decoupled responses + http conduit timeout
              Guzman Llambi­as Novice

              Hi Alessio!

               

              thanks for the answer and sorry for the long reply but just now I could return to this.

               

              I looked at the code and helped me to worked it out. This is the final client code:

               

              AddressingSampleImplService service1 = new AddressingSampleImplService();
              AddressingSample port1 = service1.getAddressingSampleImplPort(new AddressingFeature(true, true));
              
              Client client = ClientProxy.getClient(port);
              HTTPConduit conduit = (HTTPConduit)client.getConduit();
              HTTPClientPolicy policy = conduit.getClient();
                     
              //set low connection and receive timeouts to ensure the http client can't keep the connection open till the response is received
              policy.setConnectionTimeout(5000); //5 secs
              policy.setReceiveTimeout(10000); //10 secs
              ((ClientImpl)client).setSynchronousTimeout(120000);
              policy.setDecoupledEndpoint("http://localhost:18181/jaxws-samples-wsa/decoupled-endpoint");
              
              int result = port1.add(1, 2);
              System.out.println("Result: "+result);
              System.out.println("Call Over!");
              
              

               

              The key code is this one:

               

              ((ClientImpl)client).setSynchronousTimeout(120000);
              
              

               

              Is there a way to have this same configuration but not to use the HTTPConduit? for example, sending the response to another WS in another server? Maybe using AddressingProperties?

               

              thanks

              Guzmán

              • 4. Re: Re: WS-Addressing + decoupled responses + http conduit timeout
                Alessio Soldano Master

                Guzman LlambiÂas wrote:

                 

                The key code is this one:

                 

                1. ((ClientImpl)client).setSynchronousTimeout(120000); 

                 

                Is there a way to have this same configuration but not to use the HTTPConduit? for example, sending the response to another WS in another server? Maybe using AddressingProperties?

                 

                mmh... not really, sorry, this is a CXF impl detail.