This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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.
 
jQuery in Action, 2nd edition
 
subject: Programmatically setting user name with Rampart
 
Similar Threads
SOAP Header missing using Rampart w/ Axis2 Generated Stub
Unable to get Rampart setup correctly with Axis2
Axis2/Rampart compatability
Generate Security Header for Axis 2 with xmlbeans
How do you define in your code which key/passw to associate with which application