On Thu, Aug 4, 2011 at 9:57 AM, Jay Sullivan <[email protected]> wrote:
> > > On Wed, Aug 3, 2011 at 9:22 PM, Hasini Gunasinghe <[email protected]>wrote: > >> Hi Jay, >> >> Have you engaged Rampart, and provided the rampart configuration properly >> in the Axis2 client side? >> >> You can refer to rampart samples[1] to verify this. >> Also, the article[2] on message level security with Rampart may help. >> >> [1] >> http://svn.apache.org/repos/asf/axis/axis2/java/rampart/trunk/modules/rampart-samples/policy/ >> [2] http://wso2.org/library/3415 >> >> Thanks, >> Hasini. >> >> > I read somewhere that it's not necessary to engage rampart; that it would > engage itself when needed. Is this wrong? > > I'm using axis-1.5.5, and rampart-1.6.0. When I try to explicitly engage > rampart, I get this error: > > Exception in thread "main" org.apache.axis2.AxisFault: Unable to engage > module : rampart > > And yes I have a repository configured properly, as I can load the > "addressing-1.5.5" module without trouble, and they're in the same > directory. Am I running into a version conflict? > > > -- > Jay Sullivan > I've tried using axis-1.6.0, and rampart-1.6.0. Same issue. Here's what I did. I generated a web service client stub by running: $AXIS2_HOME/bin/wsdl2java.sh -uw -o . -uri http://path/to/my/service.wsdl I then created this client program which relies on the stub : package org.tempuri; > import org.apache.axis2.context.ConfigurationContext; > import org.apache.axis2.context.ConfigurationContextFactory; > import org.apache.axis2.client.ServiceClient; > import org.apache.axis2.client.Options; > import org.apache.axis2.AxisFault; > import org.apache.log4j.Logger; > import org.apache.log4j.Level; > import org.apache.axis2.transport.http.HttpTransportProperties; > import > org.apache.axis2.transport.http.HttpTransportProperties.Authenticator; > public class MagicEightBallServiceCGClient > { > public static void main(String[] args) throws Exception > { > Logger.getRootLogger().setLevel(Level.OFF); > > /* Get repository context */ > ConfigurationContext ctx = > ConfigurationContextFactory.createConfigurationContextFromFileSystem(System.getenv("AXIS2_HOME") > + "/repository",null); > > /* Get Service stub */ > MagicEightBallServiceStub stub = new > MagicEightBallServiceStub(ctx); > > /* Engage addressing and rampart modules */ > ServiceClient sc = stub._getServiceClient(); > sc.engageModule("addressing"); > sc.engageModule("rampart"); > > /* Set options */ > Options options = sc.getOptions(); > options.setUserName("USERNAME"); > options.setPassword("PASSWORD"); > > /* Consume service */ > System.out.println(stub.getAdvice()); > } > } > Notice how my service is called "MagicEightBallService", and has a single void service method called "getAdvice()", (it returns a magic eight ball fortune). Located within $AXIS2_HOME/repository/modules/ are the files: modules.list addressing-1.6.0.mar ping-1.6.0.mar rampart-1.6.0.mar > soapmonitor-1.6.0.mar > mex-1.6.0.mar mtompolicy-1.6.0.mar rahas-1.6.0.mar scripting-1.6.0.mar > I then run the program with : java -cp build/lib/MagicEightBallService-test-client.jar:$AXIS2_HOME/lib/* > org.tempuri.MagicEightBallServiceCGClient > And the result is this error: Exception in thread "main" org.apache.axis2.AxisFault: Unable to engage > module : rampart > at > org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:363) > at > org.tempuri.MagicEightBallServiceCGClient.main(MagicEightBallServiceCGClient.java:26) > Note that I don't get an error if I don't try to engage rampart, i.e., a non-secure web client. What am I doing wrong? -- Jay Sullivan
