Hi,

thanks for your reply.
I think I should be more specific about my question.
I have added the usernametoken to the policy in the services.xml:

 <sp:SupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>  
           <wsp:Policy>  
               <sp:UsernameToken/>  
           </wsp:Policy>  
       </sp:SupportingTokens> 

This works fine. 
My problem is how to insert the usernametoken into the soap header
programmatically in the client. Here is my current attempt:

SecureServiceStub stub = new
SecureServiceStub(ctx,"http://localhost:8079/axis2/services/SecureService";);
ServiceClient sc = stub._getServiceClient();
sc.engageModule("rampart");
sc.getOptions().setUserName("brian");
sc.getOptions().setPassword("brianPasswords");          
--- rest of boiler plate code to set up encryption which works fine--------

When i run this client i get the following exception:
xception in thread "main" org.apache.axis2.AxisFault: UsernameToken missing
in request
        at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)

So which api calls do i need to make to insert the token into the header?

thanks again,

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-tp21641020p21670839.html
Sent from the Axis - User mailing list archive at Nabble.com.

Reply via email to