I want to consume a web service in Java and I am using JAX.WS. Everything is working fine until I try to consume a webservice over SSL (https). I have added the certificate of the site to keystore using keytool. Still no success. Anyone has done it before ? The webservice is from a third party payment gateway like paypal-payflo etc… so regular webservice whose certificate comes from Verisign. Any tip would help. It is a SOAP webservice with wsdl.
The error trace:
Exception in thread “main” javax.xml.ws.WebServiceException: Failed to
access the WSDL at:
xxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl. It failed
with: Got Connection refused: connect while opening stream from
xxxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl. at
com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:173)
at
com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:155)
at
com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:120)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:260)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.(WSServiceDelegate.java:223)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.(WSServiceDelegate.java:171)
at
com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:96)
Does setting your own keystore to javax.net.ssl.trustStore help?
Be sure to check if you can read from that path (current example assumes
local.keystoreis in classpath.