4

I am developing a Java desktop application and I want to consume a web service in it. The web service requires two-way SSL connection with message level security using binarysecuritytoken. I am using NetBeans IDE 6.9.1 with JDK 1.6.0.23 and JAX-WS as ws wrapper. How can I communicate with the ws without using any web server on client machine. Most of the stuff I read needs to have tomcat or some other web server on client machine (configuring the keystore in tomcat or so...). Is it possible to do? Please suggest some article for SSL based ws client for Java desktop application.

1
  • 1
    In simple words, i need a J2SE solution for consuming SSL-secured web service without using any J2EE container Commented Jan 18, 2011 at 12:03

1 Answer 1

3

Consuming web services in JavaSE - see NetBeans tutorial

Use BindingProvider to set your properties before you invoke the service. See example of using BindingProvider here

Sign up to request clarification or add additional context in comments.

7 Comments

How to Sign the SOAPHeader using the BindingProvidor?? I want to add a signed SOAPHeader to the request/port generated by JAX-WS. There are extensions of BindingProvidor such as WSBindingProvider in jaxws-rt but it also uses J2EE container.
When the webservice publish the WSDL, there will be security descriptors. You will then use wsimport to generate the client side artifact from the WSDL document then configure it appropriately. There is a simple tutorial (a bit dated but the concepts are all there) here (netbeans.org/kb/docs/websvc/wsit.html) using Netbeans.
What I mention above is message level security. If you just want to secure point-to-point with SSL, then see this java-tips.org/java-ee-tips/java-api-for-xml-web-services/…
So there is no solution for the problem. I have to install either a web server(Tomcat) or an application server(Glassfish) on every client machine to run a small application. Even for custom SoapHeaders there is no built-in mechanism in J2SE and one has to use WSS4J, axis or metro (for example accessing BinarySecurityToken or SecurityTokenReference)
You mentioned in your question that you want to consume webserivce in JavaSE. In JDK6, there is a wsimport tool which generates the artifact for a deployed service. If the deployed service has security descriptors in the wSDL, then wsimport will generate a corresponding set of handlers for you like BinarySecurityToken, etc.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.