You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Ruchith Fernando <ru...@apache.org> on 2008/03/03 05:59:04 UTC

Re: "Unable to engage module : rampart" exception.

Hi,

What is your axis2 version?

Please try with the current SNAPSHOT [1]

Thanks,
Ruchith

1. http://people.apache.org/dist/axis2/nightly/

Sanjay Vivek wrote:
> Hi all,
> 
> I'm still unable to solve the "Unable to engage module : rampart"
> problem. Basically, I downloaded the lasted rampart-SNAPSHOT.mar module.
> However, when I try to call the policy based service with my client, I
> get the following exception:
> 
> Exception in thread "main" org.apache.axis2.AxisFault: Unable to engage
> module : rampart
> 	at
> org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:33
> 9)
> 	at
> org.apache.rampart.policy.CommandLineClient.main(CommandLineClient.java:
> 64)
> 
> However, everything works perfectly with rampart-1.3.mar so it appears
> the service itself is fine. 
> 
> I've also tried putting my axis2.xml as a parameter to the
> ConfigurationContext object as suggested by Joana Trindade and as
> described in [1] but no luck either. Is there anything else I need to
> configure to get it working? Any pointers will be really helpful. I've
> also added the client used to invoke the service below. Cheers.
> 
> [1] -
> http://mail-archives.apache.org/mod_mbox/ws-rampart-dev/200802.mbox/%3c9
> e2fff830802210213k53e2d394u9611f1ac5737829e@mail.gmail.com%3e
> 
> Regards
> Sanjay
> 
> public class CommandLineClient {
> 
>       private static EndpointReference targetEPR = 
>         new EndpointReference(
>             "http://localhost:8080/axis2/services/PolicyEchoService");
> 	
> 	private static String confPath = "C:\\rampart\\policy";
> 	private static String axisPath =
> "C:\\axis2-1.3\\conf\\axis2.xml";
> 	
> 	
> 	
>     public static void main(String[] args) throws Exception {
> 
>         ConfigurationContext ctx = 
>         	ConfigurationContextFactory.
>         	   createConfigurationContextFromFileSystem(confPath,
> axisPath);
>     	
>         ServiceClient client = new ServiceClient(ctx, null);
>         Options options = new Options();
>         options.setAction("urn:echo");
>         options.setTo(targetEPR);
>         options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
> loadPolicy( confPath + "/conf/policy.xml"));
>         
>         
>         //this username is authenticated against the PWHandlerClient
> class
>         options.setUserName("sanjay");
>         client.setOptions(options);
>         
>         client.engageModule("addressing");
>         client.engageModule("rampart");
>         
>         OMElement result = client.sendReceive(getPayload());
>         
>         String response = result.getFirstElement().getText();
>         System.out.println(response);    
>     }
>     
>     private static Policy loadPolicy(String xmlPath) throws Exception {
>         StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
>         return PolicyEngine.getPolicy(builder.getDocumentElement());
>     }
>     
>     
>     private static OMElement getPayload() {
>         OMFactory factory = OMAbstractFactory.getOMFactory();
>         OMNamespace ns =
> factory.createOMNamespace("http://policy.rampart.apache.org","ns1");
>         OMElement elem = factory.createOMElement("echo", ns);
>         
>         return elem;
>     }
>     
> }
>