2 Replies Latest reply on Dec 19, 2016 4:23 PM by George Mathias

    Wildfly10.1: CXF timesout when calling SOAP webservices

    George Mathias Newbie

      OK, I ran into this again, unfortunately. Wildfly10.1 (CXF 3.1.6) timesout in 60 seconds.

      I had exact same issue when I was upgrading to wildfly8.2 and described here. The solution was suggested to be implemented in wildfly 9 to set cxf system properties.

       

      Exception is:

       

      Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://test-server/test/v2.0.0/TestService?wsdl: Read timed out

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_25]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_25]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_25]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:408) [rt.jar:1.8.0_25]

          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1347)

          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1331)

          at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)

          at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632)

          at org.jboss.wsf.stack.cxf.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:120)

          ... 38 more

      Caused by: java.net.SocketTimeoutException: Read timed out

          at java.net.SocketInputStream.socketRead0(Native Method) [rt.jar:1.8.0_25]

          at java.net.SocketInputStream.read(SocketInputStream.java:150) [rt.jar:1.8.0_25]

          at java.net.SocketInputStream.read(SocketInputStream.java:121) [rt.jar:1.8.0_25]

          at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) [rt.jar:1.8.0_25]

          at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) [rt.jar:1.8.0_25]

          at java.io.BufferedInputStream.read(BufferedInputStream.java:345) [rt.jar:1.8.0_25]

          at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:703) [rt.jar:1.8.0_25]

          at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) [rt.jar:1.8.0_25]

          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534) [rt.jar:1.8.0_25]

          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) [rt.jar:1.8.0_25]

          at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) [rt.jar:1.8.0_25]

          at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:266)

          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1545)

          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1515)

          at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1318)

      I tried:

      1) Adding properties standalone.xml

      ....

      </extensions>

      <system-properties>

        <property name="cxf.client.connectionTimeout" value="90000"/>

        <property name="cxf.client.receiveTimeout" value="120000"/>

      </system-properties>

      <management>

      .....

       

      2) Passing properties from standalone.conf

      JAVA_OPTS="$JAVA_OPTS -Dcxf.client.connectionTimeout=90000" 
      JAVA_OPTS
      ="$JAVA_OPTS -Dcxf.client.receiveTimeout=120000"
      JAVA_OPTS
      ="$JAVA_OPTS -Dhttp.receive.timeout=120000"

      While debugging, these properties show up in the application but do nothing.

      3) Tried the solution here.

      I am running out of ideas, next would to do exact same as what I did for 8.2 upgrade. Rebuild cxf with new receive time out value and using that jar.

      I would prefer to edit wildfly code to see where it is taking "cxf.client.receiveTimeout", perhaps fix it it in wildfly if I could. But from what i searched so far, i cannot find how these properties are being handed over to cxf by wildfly.

        • 1. Re: Wildfly10.1: CXF timesout when calling SOAP webservices
          Frank Langelage Master

          My solution for this propblem working with Wildfly 8.10 and 10.1:

          {code:java}

             VersionWSI wsi = this.getPort( new QName( "http://common.ws.fn.mbisoftware.biz/", "VersionWSPort" ), VersionWSI.class );
             Helper.modifyReceiveTimeout( wsi );

          {code:java}

          {code:java}

          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 );
          }

          {code:java}


          Therefore I had to add

             <module name="org.apache.cxf.impl" />

          as new dependency in jboss-deployment-structure.xml.

          • 2. Re: Wildfly10.1: CXF timesout when calling SOAP webservices
            George Mathias Newbie

            Thank you. I am using SAAJ for calling service hence, I do not have access to Client Proxy. Here's the code:

             

            addBody(soapMessage,soapFactory,soapRequestDoc,serviceName);

                                logger.debug(soapMessage);

                                soapConnFactory = SOAPConnectionFactory.newInstance();

                                soapConn = soapConnFactory.createConnection();

                                logger.debug("Invoking service ["+serviceName+

                                            "] on WSDL ["+

                                            wsdlLoc+"] ...");

                                responseMsg = soapConn.call(soapMessage, wsdlLoc); // exception is thrown here after 60 seconds.