aspose file tools*
The moose likes Web Services and the fly likes How I make a web client except any certificate via https Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How I make a web client except any certificate via https" Watch "How I make a web client except any certificate via https" New topic
Author

How I make a web client except any certificate via https

John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
Hi,
I have jax-ws web service runs via http. There is a wsdl.
I wrote a client that fails on handshake because of the certificate.
How I make the client except everything and just work.
In c# I had to add the following lines of code:


and then the usage:



thanks.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you tried including the following code snipped on the client side?

If there are problems, try modifying the verify method so that it always returns true.
Best wishes!
John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
thanks a lot but I do not see that the method verify is being hit (and it did not work) although : HttpsURLConnection.setDefaultHostnameVerifier is executed
John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
by the way these are the imports I made:
javax.net.ssl.HttpsURLConnection
javax.net.ssl.HostnameVerifier

are these correct?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
John Landon wrote:by the way these are the imports I made:
javax.net.ssl.HttpsURLConnection
javax.net.ssl.HostnameVerifier
are these correct?

Yes, they are correct.
Did you generate the portable artifacts for the web service client with wsimport?
Best wishes!
John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
Thank a lot. But this utility does not work. It says:
parsing WSDL...


[ERROR] sun.security.validator.ValidatorException: PKIX path building failed: s
n.security.provider.certpath.SunCertPathBuilderException: unable to find valid
ertification path to requested target

Failed to read the WSDL document: https://localhost:9091/services/WebService?ws
l, because 1) could not find the document; /2) the document could not be read;
) the root element of the document is not <wsdl:definitions>.


[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):

At least one WSDL with at least one service definition needs to be provided.


Failed to parse the WSDL.


My wsdl is:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How I make a web client except any certificate via https