Hi,

thanks to everyone again who has replied.
I would prefer not to add custom headers to the soap message, i want to use
the ws-security usernametoken. 
Thanks Leander for your response, but that approach did not work.
In the wss4j documentation, is the following code snippit. 
Unfortunately, it is not clear on which object the _setPropery in on - its
is not on any generation code from wsdl2java or in the apit:

 PingServiceLocator service = new PingServiceLocator();
    ...
 PingPort port = (PingPort) service.getPing1();
 port._setProperty(UsernameToken.PASSWORD_TYPE, WSConstants.PASSWORD_TEXT);
 port._setProperty(WSHandlerConstants.USER, "werner");

This is from the package description of org.apache.ws.axis.security.

I had success with the following approach , but all these classes are
deprecated, and no alternative is suggested in the api.

        OutflowConfiguration outflowConfig = new OutflowConfiguration();

                                              
outflowConfig.setActionItems("UsernameToken");

                                               outflowConfig.setUser("bob");

                                              
outflowConfig.setPasswordCallbackClass("test1.security.PWCBClientHandler");

                                              
axisstub._getServiceClient().getOptions().setProperty(WSSHandlerConstants.OUTFLOW_SECURITY,

                                                                             
outflowConfig.getProperty()); 

I am trying to attempt something basic here, unfortunately the api doc is
quite poor.
Any ideas?

Brian

brianfm wrote:
> 
> Hi,
> 
> My application requires that I programmatically set a username and
> password into the ws-security standard locations in the soap header. Note
> that I do not want to configure Rampart athentication because
> authentication logic will be fully proprietery in the server.
> I intend to just retrieve the usename/password from soap header
> programmtically from server and then authenticate. 
> 
> thanks,
> 
> Brian
> 

-- 
View this message in context: 
http://www.nabble.com/setting-username-password-in-soap-header-programmatically-tp21641020p21689872.html
Sent from the Axis - User mailing list archive at Nabble.com.

Reply via email to