• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How I make a web client except any certificate via https

 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic