aspose file tools*
The moose likes Web Services and the fly likes Programmatically setting user name with Rampart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Programmatically setting user name with Rampart" Watch "Programmatically setting user name with Rampart" New topic
Author

Programmatically setting user name with Rampart

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
So I managed to get my web service up and running with Rampart. However, I have to define the user name for the client in the axis2.xml file. I'd like to be able to set this programmatically, but I'm not sure how to go about doing that. I did some searching, but wasn't able to find any solutions other than don't use Rampart. I'm using Axis2 1.4.1 and Rampart 1.4
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Ah-hah! Apparently, when Axis2 calls the password handler, you can change the user in the method. You simply call setIdentifier on the WSPasswordCallback. It's the same object that you set the password on. It will override the value set in the axis2.xml file. Not my preferred solution, but it's better than nothing.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Programmatically setting user name with Rampart