Mikhail

Yes I have experience of doing this. The latest Axis2 1.2 release will
embed the policy into the code-generated stub and attempt to engage
Rampart with that policy.

Alternatively you can explicitly set the policy using:

StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
Policy policy = PolicyEngine.getPolicy(builder.getDocumentElement());
stub._getServiceClient().getOptions().setProperty(RampartMessageData.KEY_RAMPART_POLICY,
policy);

In general you also need to configure Rampart with information like
passwords etc.

You do this using another policy file like this:

<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy";>
 <ramp:timestampTTL>303</ramp:timestampTTL>
<ramp:encryptionUser>me</ramp:encryptionUser>
 <ramp:passwordCallbackClass>PWCallback</ramp:passwordCallbackClass>
,,,
</ramp:RampartConfig>

You can merge the two policies first - so:

StAXOMBuilder builder = new StAXOMBuilder(dotnetPolicy);
Policy dotnetPolicy = PolicyEngine.getPolicy(builder.getDocumentElement());
StAXOMBuilder builder2 = new StAXOMBuilder(rampartPolicy);
Policy rampartPolicy = PolicyEngine.getPolicy(builder.getDocumentElement());
Policy policy = dotnetPolicy.merge(rampartPolicy);

And then set it onto the stub or service client as above.

Paul

On 5/16/07, Mikhail Maroukhine <[EMAIL PROTECTED]> wrote:
Hello all,

Has anybody experience with bundle of axis2 client and .Net web service?
Is it possible to organize with rampart secured communications using
.Net's policy file?

thanks,
Mikhail

P.S. Here is header of that policy file

 <?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="http://schemas.microsoft.com/wse/2003/06/Policy";>
 <mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy";>
   <!--The following policy describes the policy requirements for the
service: http://XXX.asmx .-->
   <endpoint uri="Http://XXX.asmx">
     <defaultOperation>
       <request policy="#Sign-SCT" />
       <response policy="#Sign-SCT-1" />
       <fault policy="" />
     </defaultOperation>
     <operation
requestAction="http://schemas.xmlsoap.org/ws/2004/04/security/trust/RST/SCT";>

       <request policy="#Sign-Username" />
       <response policy="#Sign-X.509" />
       <fault policy="" />
     </operation>
   </endpoint>
....
 </mappings>
 <policies
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy";
xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext";
xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy";
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing";>
   <wsp:Policy wsu:Id="Sign-Username">
     <wsp:MessagePredicate wsp:Usage="wsp:Required"
Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part";>wsp:Body()
wsp:Header(wsa:To) wsp:Header(wsa:Action) wsp:Header(wsa:MessageID)
wse:Timestamp()</wsp:MessagePredicate>
     <wssp:Integrity wsp:Usage="wsp:Required">
...

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
[EMAIL PROTECTED]

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to