How to specify a policy file in a WS client (AXIS2)

I am trying to access a dot net web service and i want to make use of the policy file they gave me. i read that AXIS2 supports WS-Policy in the client side but i still can not figure out how to tell the client to use the file. I searched thouroghly for examples and searched through diffirent forums with no success. I found only similar questions with no answer. if somebody could help it would be appreciated.

Thank you

[434 byte] By [khalleda] at [2007-10-3 9:41:24]
# 1

We you codegen a Policy annotated WSDL, the policies are get included in the stub. Hence you don't have to specify a separate Policy file.

But if you need to use a separate policy then you need to set them in the AxisDescription object that you use in the ServiceClient and OperationClient.

e.g.

ServiceClient serviceClient = new ServiceClient();

OperationClient operationClient = serviceClient

.createClient(ServiceClient.ANON_OUT_IN_OP);

FileInputStream fis = new FileInputStream("path-to-policy.xml");

Policy servicePolicy = PolicyEngine.getPolicy(fis);

AxisService axisService = serviceClient.getAxisService();

axisService.getPolicyInclude().setPolicy(servicePolicy);

If you need more information please repost this to axis-dev@ws.apache.org with a [AXIS2] subject prefix.

Sanka.Samaranayakea at 2007-7-15 4:57:31 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...