Good day
I have been searching the web, and so far the following solution seems the closest i can get to a solution without any 3rd party libraries but it doesn't work. :(
I do not have a wsdl I can stub. I am calling an external webservice and simply passing in a soap message.
I tested the same code using no container, ie. in a main method in my ide and it works there, when i deploy to wildfly10 it looks like its being ignored or overridden by jboss.
I cannot find any properties in the standalone.xml to edit to change readtimeout settings and it needs to be for this webservice call only.
My debugging LOG doesn't print anything to the logs which suggests it isn't being executed. I am expecting an immediate error because of the setReadTimeout(1);
Anyone with any ideas?
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
URL endpoint = new URL (null, ENDPOINT, new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL u) throws IOException {
LOG.debug("1.");
URL clone = new URL (u.toString ());
LOG.debug("2.");
URLConnection connection = clone.openConnection ();
LOG.debug("3.");
connection.setConnectTimeout (10000);//10 seconds
LOG.debug("4.");
connection.setReadTimeout (1);//1 ms
LOG.debug("5.");
return connection;
}
});
SOAPMessage soapResponse = soapConnection.call(soapMsg, endpoint);
If i edit the call line to the following, the readtimeout works, but i get http 500,but the url is correct:
SOAPMessage soapResponse = soapConnection.call(soapMsg, endpoint.getContent());