1

we have soap request where we have setup time out for 300ms, when we make a request its taking more than 300ms like 1500ms or more but we are not getting time out exception which we have set in response.

This way we are making call

SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(requestWrapper, parammap), endpoint);

and the endpoint forms in init method like this

    endpoint = new URL(new URL(URL_CONSTANT), super.getEndpoint(), new URLStreamHandler() {
        @Override
        protected URLConnection openConnection(URL url) throws IOException {
            URL target = new URL(url.toString());
            URLConnection connection = target.openConnection();
            // Connection settings
            connection.setConnectTimeout(getTimeout());
            connection.setReadTimeout(getTimeout());
            return (connection);
        }
    });

in above code getTimeout() function works properly and it set 300 but we are not sure why its not working, pls suggest something.

Sanjay Rabari
  • 2,091
  • 1
  • 17
  • 32
  • 1
    Possible duplicate of [Setting socket read timeout with javax.xml.soap.SOAPConnection](https://stackoverflow.com/questions/9536616/setting-socket-read-timeout-with-javax-xml-soap-soapconnection) – craigcaulfield May 14 '18 at 13:18

1 Answers1

0

The soapConnection.call method will call the HttpSOAPConnection.post which has a local connection parameter(HttpURLConnection httpConnection. ) that is created using the endPoint.

Try debugging this method(post) to see what is the time out for the actual connection which is used to perform the SOAP call (i.e httpConnection local variable inside the post method).

dj_frunza
  • 1,553
  • 3
  • 17
  • 28