aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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: 42906
    
  69
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.
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: 42906
    
  69
Those methods are used for HTTP authentication, not for WS-Security authentication.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting wsse:Security from Java swing client