wood burning stoves*
The moose likes Web Services and the fly likes Setting wsse:Security from Java swing client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Setting wsse:Security from Java swing client" Watch "Setting wsse:Security from Java swing client" New topic
Author

Setting wsse:Security from Java swing client

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
I have a java swing client that makes calls to a web service through a proxy. How can I set the Username and password in the wsse:UsernameToken so that it will pass security on the server?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
This article (written by, ahem, myself) shows how to write Java clients that use WS-Security authentication, and has example code. It's all done with config files, not programmatically, though.


Ping & DNS - my free Android networking tools app
Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
I added the following code however when I run the application outside of
Rad I still get an error stating that the security token is missing.

OffsiteCustomerService service = offsite.getOffsiteCustomerService();

Stub stub = (Stub) service;
stub._setProperty(Stub.USERNAME_PROPERTY, "username");
stub._setProperty(Stub.PASSWORD_PROPERTY, "password");
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost****");
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
Those methods are used for HTTP authentication, not for WS-Security authentication.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Setting wsse:Security from Java swing client
 
Similar Threads
jsp to swing
What is the best way for reporting in JavaSwing Application?
Why Desktop Java Live? Why not Swing Live?
JSP swing communication
Swing Client