Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-4476

Unable to configure CXF socket timeout

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 8.1.0.Final, 8.2.0.Final, 9.0.0.Beta2
    • Fix Version/s: 9.0.0.CR1
    • Component/s: Web Services
    • Labels:
    • Environment:

      Java8, Ubuntu Linux Desktop

    • Steps to Reproduce:
      Hide

      1. Deploy a webservice on any application server for e.g. on port localhost:8080. Start this application server.

      2. Create a simple HTTPServlet and call callWebService() method described above in Description using SAAJ api that calls the WSDL deployed to localhost:8080
      2. Deploy a TestWeb.war on a wildly 8.2 Final on localhost:3080
      3. Ensure webservice deployed on localhost:8080 takes longer than 60 seconds either by pausing programmatically. The way I did is by setting the breakpoint by running the application server from within myeclipse ide.
      4. Now call the servlet deployed on localhost:3080 which calls the webservice.
      5. The webservice call should time out in 60 seconds with an socket exception.

      Show
      1. Deploy a webservice on any application server for e.g. on port localhost:8080. Start this application server. 2. Create a simple HTTPServlet and call callWebService() method described above in Description using SAAJ api that calls the WSDL deployed to localhost:8080 2. Deploy a TestWeb.war on a wildly 8.2 Final on localhost:3080 3. Ensure webservice deployed on localhost:8080 takes longer than 60 seconds either by pausing programmatically. The way I did is by setting the breakpoint by running the application server from within myeclipse ide. 4. Now call the servlet deployed on localhost:3080 which calls the webservice. 5. The webservice call should time out in 60 seconds with an socket exception.
    • Affects:
      Compatibility/Configuration, User Experience
    • Workaround Description:
      Hide

      Not yet. But going back to jboss7.1.1 Final. This works in Jboss7.1.1 but stopped working in wildfly8.1, wildfly 8.2 and wildfly 9.2BETA.

      Show
      Not yet. But going back to jboss7.1.1 Final. This works in Jboss7.1.1 but stopped working in wildfly8.1, wildfly 8.2 and wildfly 9.2BETA.

      Description

      Socket times out after 60 seconds when calling SAAJ webservices from a wildfly servlet. Wildfly uses CXF internally and CXF HTTP Conduit times out in 60 seconds by default. Cannot find a way to configure this timeout (Receive timeout) in standalone.xml file.

      Following line throws socket read time out exception
      responseMsg = soapConn.call(soapMessage, wsdlLoc);

      Java Call is:
      private static String callWebService(String serviceName,
      String userName,
      org.w3c.dom.Document soapRequestDoc,
      String serviceType,
      String endPointAddress,
      String remoteClientAddress,
      String remoteClientHostname,
      String remoteClientUser,
      String clientApplicationId)
      throws SOAPException,java.io.IOException,CommunicationException
      {
      SOAPConnection soapConn = null;
      String wsdlLoc=endPointAddress;
      String resp = "";
      MessageFactory msgFactory;
      SOAPFactory soapFactory;
      SOAPMessage soapMessage;
      SOAPConnectionFactory soapConnFactory;
      SOAPMessage responseMsg;

      try

      { if (wsdlLoc == null) throw new SOAPException("Error: Endpoint address is NULL."); msgFactory = MessageFactory.newInstance(); soapFactory = SOAPFactory.newInstance(); soapMessage = msgFactory.createMessage(); //Add headers addSoapHeaders(soapMessage,soapFactory, serviceType,userName,remoteClientAddress,remoteClientHostname, remoteClientUser, clientApplicationId); //Add Body 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); logger.debug("Call completed ["+serviceName+ "] on WSDL ["+ wsdlLoc+"]!"); resp = processResponseMessageStringParser(responseMsg); logger.debug("Return Document [" + resp + "]"); }

      catch (SOAPException e)

      { logger.error(e); throw new CommunicationException(errorBuffer.toString()); }

      finally
      {
      try

      { if (soapConn != null) soapConn.close(); }

      catch (Exception e)

      { e.printStackTrace(); }

      }

      return resp;
      }

      Exception thrown is:
      javax.xml.soap.SOAPException: JBWS024004: SOAP message could not be sent
      at org.jboss.wsf.stack.cxf.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:124)
      at com.qwest.servlet.Client.callWebService(Client.java:225)
      at com.qwest.servlet.Client.call(Client.java:138)
      at com.qwest.servlet.TestServlet.doGet(TestServlet.java:73)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
      at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:278)
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://localhost:8080/TestWS/v2.0.0/TestServer?wsdl: Read timed out
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
      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)
      ... 31 more
      Caused by: java.net.SocketTimeoutException: Read timed out
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:150)
      at java.net.SocketInputStream.read(SocketInputStream.java:121)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
      at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:703)
      at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
      at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
      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)

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  asoldano Alessio Soldano
                  Reporter:
                  GeorgeMathias George Mathias
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: