Sanjay Vivek wrote:
 Hi Nandana,

The following code snippet below shows how I've gone about using the
ServiceClient to set the username and password:

ConfigurationContext ctx = ConfigurationContextFactory
  .createConfigurationContextFromFileSystem(axis2ConfPath, null);

ServiceClient client = new ServiceClient(ctx, null);
OMElement payload = client.sendReceive(getPayload("Hello world"));

Options options = new Options();
client.engageModule(new QName("rampart"));

options.setTo(targetEPR);
options.setAction("urn:echo");

options.setUserName("bob");
options.setPassword("wspwd");

client.setOptions(options);
result = client.sendReceive(payload);


However, the client seems to be picking up the "user" value from the
"OutflowSecurity" element which is defined in client.axis2.xml (from
axis2ConfPath/conf). How do I override the "user" value in
client.axis2.xml so that the client picks up the username from
'options.setUserName("bob")'? Any help would be appreciated. Cheers.

options.setUserName/Password approach is not valid for parameter based configuration. This can only be used with the policy based approach.

Thanks,
Ruchith


Regards
Sanjay




Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to