axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thilina Mahesh Buddhika <thilin...@gmail.com>
Subject Re: Problem using WSSPolicy with generated client stubs
Date Wed, 09 Dec 2009 12:59:15 GMT
a typo in the last line of code snippet.

options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

thanks.
/thilina

Thilina Mahesh Buddhika
http://blog.thilinamb.com


On Wed, Dec 9, 2009 at 6:27 PM, Thilina Mahesh Buddhika <thilinamb@gmail.com
> wrote:

> Hi Shaan,
>
> This is the widely used approach of attaching a security policy to a
> client.
>
>                 StAXOMBuilder builder = new
> StAXOMBuilder("/path/to/policy");
>         Policy policy
> = PolicyEngine.getPolicy(builder.getDocumentElement());
>
>         RampartConfig rc = new RampartConfig();
>         // set the parameters to rampart config.
>
>         policy.addAssertion(rc);
>
>         ServiceClient client = stub._getServiceClient();
>         Options option = client.getOptions();
>         options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
> loadPolicy(policy));
>
> HTH.
>
> Thanks.
> /thilina
>
> Thilina Mahesh Buddhika
> http://blog.thilinamb.com
>
>
>
> On Tue, Dec 8, 2009 at 4:07 PM, Shaan Jayaratna <jayaratna@predic8.de>wrote:
>
>> Hi.
>>
>> I want to use WSSPolicy with Axis2 1.5.1 and Rampart 1.4. Deploying the
>> service with an attached Policy works fine. Creating the stubs with
>> WSDL2Java don't cause an error. But when I send a request there are no
>> WSSHeaders generated.
>>
>> Rampart is engaged. Using the OutflowSecurity parameter WSS works on the
>> client side.
>>
>> Without the OutflowSecurity parameter I use the RampartConfig class to
>> configure the client:
>>
>>  RampartConfig rampartConfig = new RampartConfig();
>>  rampartConfig.setUser("client");
>>  rampartConfig.setPwCbClass("PWDCallback");
>>       CryptoConfig sigCrypto = new CryptoConfig();
>>  sigCrypto.setProvider("org.apache.ws.security.components.crypto.Merlin");
>>       Properties props = new Properties();
>>  props.setProperty("org.apache.ws.security.crypto.merlin.keystore.type",
>> "JKS");
>>
>>  props.setProperty("org.apache.ws.security.crypto.merlin.file","client.jks");
>>  props.setProperty("org.apache.ws.security.crypto.merlin.keystore.password",
>> "apache");
>>       sigCrypto.setProp(props);
>>       rampartConfig.setSigCryptoConfig(sigCrypto);
>>       Policy policy = new Policy();
>>  policy.addAssertion(rampartConfig);
>>  stub._getServiceClient().getAxisService().getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY,
>> policy);
>>
>> Thanks,
>> Shaan
>>
>>
>

Mime
View raw message