Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How I make a web client except any certificate via https

 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by the way these are the imports I made:
javax.net.ssl.HttpsURLConnection
javax.net.ssl.HostnameVerifier

are these correct?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic