0

I am getting the following error when calling a soap https web service from a java client. Can anyone point me to the right direction on how to solve this issue. I have been finding solutions to this issue, but none seems to be able to give me a way out.

   Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection timed out: connect
    at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:117)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:208)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
Survivor
  • 21
  • 5

1 Answers1

0

Connection timed out means the underlying TCP connection has not been established since the first packet did not get any response.

So, some firewall is blocking your connection (this is a firewall because a router should have sent you back an ICMP error message, therefore you would not have gotten a timeout but a "destination unreachable", for instance).

The very most common case is that you have not a direct Internet connection and your web service is on the Internet, so you need to go through a proxy. In your code, you need to ask your web service library to use this proxy, and optionnally add some credentials to use this proxy.

Alexandre Fenyo
  • 3,725
  • 1
  • 11
  • 23
  • Hi Alexandre, thanks for the reply, I have a feeling that this is due to the SSL certificate authentication, but I could still be way off the actual answer. Is there code that can help me bypass the checking and how do I place it into my client so that the certificates are trusted. I did go thru some example like this one (https://stackoverflow.com/questions/875467/java-client-certificates-over-https-ssl ) but have no clue how to insert or invoke this kind of code from the java client – Survivor Sep 09 '17 at 06:03
  • No, a bad certificate can not generate a timeout error. Your problem is due to the network. You may have a problem with the certificate, but you will encounter it later, you first have to solve your networking problem. – Alexandre Fenyo Sep 09 '17 at 06:15
  • I could call the web service from SOAP UI without any issues, but when it comes to java client, I hit this problem. If it was a networking issue, then SOAP UI would also not be able to work, am I right? – Survivor Sep 09 '17 at 06:59
  • You are wrong: SoapUI proxy settings are automatically defined by default with your browser settings, on Windows. Are you working on Windows? – Alexandre Fenyo Sep 09 '17 at 07:02
  • So this is why it works with Soap UI. You definitely have a lack of proxy configuration in your java code. – Alexandre Fenyo Sep 09 '17 at 07:04
  • Is there any example of proxy configuration that I can have a try at? – Survivor Sep 09 '17 at 07:49
  • Not the best way, but the easiest one: `System.getProperties().put("proxySet", "true"); System.getProperties().put("http.proxyHost", PROXY_HOST); System.getProperties().put("http.proxyPort", PROXY_PORT);`. You may need to add other properties, if some authentication is needed, or if you have to connect to the proxy on top of SSL. – Alexandre Fenyo Sep 10 '17 at 10:23