Hi everyone,

Well I just tested that out and it seems to be working :). Cheers.

Regards
Sanjay 

>-----Original Message-----
>From: Sanjay Vivek [mailto:[EMAIL PROTECTED] 
>Sent: 18 January 2008 13:24
>To: [email protected]
>Subject: Setting the username/password programatically using 
>the policy based configuration.
>
>Hi everyone,
>
>I'm attempting to programatically set the username/password at 
>the client side using the policy based configuration. The code 
>snippet below explains how I'm going about this. Is this the 
>right way to programatically set the username/password?
>
>        ConfigurationContext ctx = ConfigurationContextFactory
>                
>.createConfigurationContextFromFileSystem(axis2ConfPath,
>null);
>        
>        ServiceClient client = new ServiceClient(ctx, null);
>
>        Options options = new Options();
>        options.setTo(targetEPR);
>        options.setAction("urn:echo");
>        options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
>loadPolicy(confPath + "/conf/axis2.xml"));
>
>        //set username/password
>        options.setUserName("bob");
>        options.setPassword("wspwd");
>        client.setOptions(options);
>        
>        
>        client.engageModule("addressing");
>        client.engageModule("rampart");
>        
>        OMElement response = client.sendReceive(getPayload("Hello
>world"));
>
>I also have a question regarding the policy.xml file. Within 
>the <RampartConfig>, there's a <user> element as shown below. 
>Do I edit this out when attempting to programatically set the 
>username? Thanks again.
>
><ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy";> 
>                       <ramp:user>alice</ramp:user>
>                       <ramp:passwordCallbackClass>
>org.apache.rampart.samples.policy.sample01.PWCBHandler</ramp:pa
>sswordCal
>lbackClass>
></ramp:RampartConfig>
>
>
>Regards
>--------------
>Sanjay Vivek
>Web Analyst
>Middleware Team
>ISS
>University of Newcastle Upon Tyne
>

Reply via email to