axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devdatta Lele <lele.devda...@gmail.com>
Subject org.apache.rampart.RampartException: Encryption token missing error
Date Fri, 04 Feb 2011 22:05:00 GMT
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.

Mime
View raw message