• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Jax-ws and setting the keystore programmatically

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am developing a web service client which is required to set the keystore programmatically.
I was given a private key, which I converted to a keystore.

If I do this:



then the web service calls work.

However, what I need to do is this:




where keystore and password are strings pointing to the appropriate file/password.

But this always gives me a handshake error.

I am trying to think of a way to confirm that this socket factory is even being called.

Any ideas?




 
John Farrel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Something indicative.

I replaced


with



And saw that the dummy calls in TestSocketFactory do not get called.

It looks like jax-ws ignores the JAXWSProperties.SSL_SOCKET_FACTORY setting completely.

 
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One question, what document/article/book did you use as an example to build this?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please try using cxf framework, which will take care of all the complex code. You need to use a configuration file in cxf where you can set the keystore file path and pwd and small code snippet, which will take care of adding certificate to request message

Thanks,
Kesava
 
John Farrel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

surlac surlacovich wrote:One question, what document/article/book did you use as an example to build this?



I used this:

stack overflow reference
 
John Farrel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kesava Krishna wrote:Please try using cxf framework, which will take care of all the complex code. You need to use a configuration file in cxf where you can set the keystore file path and pwd and small code snippet, which will take care of adding certificate to request message

Thanks,
Kesava



I'm not sure how to progress from having written a jax-ws client library to using cxf (which appears to use jax-ws underneath).
The documentation seems to say that you develop a cxf client interface the way I already have... basically using wsdl2java on a wsdl.

Can I attach cxf configuration to my existing library?

 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Farrel wrote:
I'm not sure how to progress from having written a jax-ws client library to using cxf (which appears to use jax-ws underneath).
...
Can I attach cxf configuration to my existing library?


Yes, you can, but it's not necessary on the client - you can use Apache HTTP-Client or CXF WebClient to communicate with any web-service via HTTPS.

Good example HTTPS+CXF.
 
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please go through this link till the end http://cxf.apache.org/docs/ws-security.html which will clearly explains how to attach certificate to soap request message. This is applicable for jax-ws soap request, and not for jax-rs plain xml request.


Thanks,
Kesava
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kesava Krishna wrote:This is applicable for jax-ws soap request, and not for jax-rs plain xml request.


Could you please tell us why we can't transfer public key (cert) via jax-rs plain xml request?
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should be possible by just attaching a binary (in base64 or something)?
 
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming it is purely purely jax-ws based web service it is suggested.

Thanks,
Kesava
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Kesava
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic