Thanks a lot Thilina for replying ....

So just to double check whether I am getting it correctly,

what you are saying is:

include following piece in policy.xml (which currently missing in my
policy.xml) ?

<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy";;>
            <ramp:signatureCrypto>
                <ramp:crypto
provider="org.apache.ws.security.components.crypto.Merlin"
cryptoKey="org.apache.ws.security.crypto.merlin.file"
cacheRefreshInterval="300000">
                    <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
                    <ramp:property
name="org.apache.ws.security.crypto.merlin.file">service.jks</ramp:property>
                    <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.password">servicePW</ramp:property>
                </ramp:crypto>
            </ramp:signatureCrypto>
            <ramp:encryptionCypto>
                <ramp:crypto
provider="org.apache.ws.security.components.crypto.Merlin"
cryptoKey="org.apache.ws.security.crypto.merlin.file"
cacheRefreshInterval="300000>
                    <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
                    <ramp:property
name="org.apache.ws.security.crypto.merlin.file">service.jks</ramp:property>
                    <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.password">apache</ramp:property>
                </ramp:crypto>
            </ramp:encryptionCypto>
          </ramp:RampartConfig>


But I don't have any idea where is my keystore, the filename and password of
the keystore ... where do I get this info from ?

Thanks.


On Fri, Feb 4, 2011 at 9:03 PM, Thilina Mahesh Buddhika <thilin...@gmail.com
> wrote:

> Hi,
>
> You can include them in the client side policy using the RampartConfig
> assertion.
>
> More about these assertions can be found here[1]. Please take a look at
> policy files of samples which are available in the Rampart binary
> distribution.
>
> Thanks,
> Thilina
>
> [1] - http://axis.apache.org/axis2/java/rampart/rampartconfig-guide.html
>
>
> Thilina Mahesh Buddhika
> http://blog.thilinamb.com
>
>
>
> On Sat, Feb 5, 2011 at 3:35 AM, Devdatta Lele <lele.devda...@gmail.com>wrote:
>
>> Hi,
>>
>> I am creating a simple client program in java to talk with the Server that
>> has the WS security enabled. I am new to Axis2, Rampart.
>>
>> the developer who implemented the WS security on server gave me a wsdl
>> file and told me that the he used the Rampart module for security.
>>
>> So first of all, I downloaded the wsdl file and downloaded Axis2 / Java
>> ... then I used wsdl2java tool to create java classes from wsdl file.
>>
>> I also downloaded the Rampart module and then copied all the libs
>> together  (axis 2 and rampart libs) and added in the classpath of my client
>> project in eclipse.
>>
>> Then he said follow 3 steps to start communicating with server:
>>
>> 1) Engage rampart module
>> 2) load policy to set the property of the stub that gets created in
>> wsdl2java classes
>> 3) set the key in a property of the stub.
>>
>> So I created first of all a Configurationcontext pointing to the location
>> where Rampart and Axis2 repositories are located.
>>
>> ConfigurationContext ctx =
>> ConfigurationContextFactory.createConfigurationContextFromFileSystem("C:\\axis2-1.5.4\\repository",
>> null);
>>
>> Then instantiated the stub
>>
>> ObjectWSStub ObjectStub = new ObjectWSStub(ctx, targetEndpoint);
>>
>> where targetEndpoint is the URL of the server where security is enabled.
>>
>> Then I am engaging the module:
>>
>> ObjectStub._getServiceClient().engageModule("rampart");
>>
>> And then setting the property for policy:
>>
>> ObjectStub._getServiceClient().getOptions().setProperty(RampartMessageData.KEY_RAMPART_POLICY,
>> loadPolicy("policy.xml"))
>>
>>
>> where loadPolicy is as follows and policy.xml is the piece of policy code
>> that I separated out from the wsdl file that the developer provided.
>>
>> private static Policy loadPolicy(String name) throws Exception {
>>
>>         StAXOMBuilder builder = new StAXOMBuilder(name);
>>         return PolicyEngine.getPolicy(builder.getDocumentElement());
>>
>>     }
>>
>>
>>
>>
>> Now the question is where and how do I set the key ? I have the key .. its
>> just that I dont know where and how to set.
>>
>> Please help.
>>
>> Thanks.
>>
>
>

Reply via email to