Hi Peng, Which versions of Axis2 and Rampart, are you using?
Thanks. /thilina Thilina Mahesh Buddhika http://blog.thilinamb.com On Sat, Apr 3, 2010 at 4:53 PM, peng peng <[email protected]> wrote: > Hi, > > I am integrating axis2 , rampart and tomcat these days. I followed the > tutorial of http://wso2.org/library/240 , and i tried to implement the > client in eclipse3.4. > > --service > public class SimpleService { > > public String echo(String arg) { > return "Hello "+arg; > } > } > > --service.xml > <service name="SimpleService "> > <operation name="echo"> > <messageReceiver > class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> > </operation> > <parameter name="ServiceClass" > > locked="false">org.apache.rampart.samples.sample02.SimpleService</parameter> > > <module ref="rampart" /> > > <parameter name="InflowSecurity"> > <action> > <items>UsernameToken</items> > > > <passwordCallbackClass>org.apache.rampart.samples.sample02.PWCBHandler</passwordCallbackClass> > </action> > </parameter> > </service> > > > and i tried to get the message from a client using ADB. > > --client > > public static void main(String[] args) throws Exception { > > System.setProperty("javax.net.ssl.trustStore", "C:/Program Files/Apache > Software Foundation/Tomcat 6.0/mykey/tomcat.keystore"); > System.setProperty("javax.net.ssl.trustStorePassword", "tomcat"); > > // I used ant client.02 to generate the repository which include > /conf/axis2.xml and /modules/rampart-SNAPSHOT.mar > String repository="C:/Documents and Settings/wenjund/My > Documents/erp/rampart-ut-samples/build/client_repositories/sample02"; > > ConfigurationContext ctx = > > ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, > repository + "/conf/axis2.xml"); > > SimpleServiceStub stub = new SimpleServiceStub(ctx," > https://localhost:8443/axis2/services/SimpleService"); > try { > ServiceClient client = stub._getServiceClient(); > Options options = client.getOptions(); > options.setUserName("admin"); > options.setPassword("axis2"); > client.engageModule("rampart"); > } catch (Exception e1) { > e1.printStackTrace(); > } > > String in="peng"; > String out=stub.echo(in); > System.out.println("in="+in); > System.out.println("out="+out); > } > > When i ran the client in eclipse , an error occur at > > ConfigurationContext ctx = > > ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, > repository + "/conf/axis2.xml");. > > --error > org.apache.axis2.deployment.DeploymentException: The "Dispatch" phase is > not found on the global "InFlow" phase of the axis2.xml file. Make sure the > phase is within the axis2.xml file. > > > I checked both the client and the server axis2.xml file and BOTH have the > <phaseOrder type="InFlow"> node which include a <phase name="Dispatch"> > node. > > Why i can use ant to get the service message but i can not get the message > from a client using eclipse? Any ideas, thanks. > > I am new in the feild of axis2 and rampart , and if i sent a wrong email > address, please tell me. I attached the client axis2.xml here. > > --client axis2.xml > <axisconfig name="AxisJava2.0"> > <module ref="rampart" /> > > <parameter name="OutflowSecurity"> > <action> > <items>UsernameToken</items> > <user>bob</user> > > > > <passwordCallbackClass>org.apache.rampart.samples.sample02.PWCBHandler</passwordCallbackClass> > </action> > </parameter> > > <parameter name="hotdeployment" locked="false">true</parameter> > <parameter name="hotupdate" locked="false">true</parameter> > <messageReceiver mep="INOUT" > class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> > <transportSender name="http" > class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> > <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter> > </transportSender> > <phaseOrder type="inflow"> > <!-- System pre defined phases --> > <phase name="Transport"> > <handler name="RequestURIBasedDispatcher" > > class="org.apache.axis2.engine.RequestURIBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="SOAPActionBasedDispatcher" > > class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > </phase> > <phase name="Security"/> > <phase name="PreDispatch"/> > <phase name="Dispatch" > class="org.apache.axis2.engine.DispatchPhase"> > <handler name="AddressingBasedDispatcher" > > class="org.apache.axis2.engine.AddressingBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="SOAPMessageBodyBasedDispatcher" > > class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="InstanceDispatcher" > class="org.apache.axis2.engine.InstanceDispatcher"> > <order phase="PostDispatch"/> > </handler> > </phase> > <!-- System pre defined phases --> > <!-- After Postdispatch phase module author or or service author > can add any phase he want --> > <phase name="OperationInPhase"/> > </phaseOrder> > <phaseOrder type="outflow"> > <!-- user can add his own phases to this area --> > <phase name="OperationOutPhase"/> > <!--system predefined phase--> > <!--these phase will run irrespective of the service--> > <phase name="PolicyDetermination"/> > <phase name="MessageOut"/> > </phaseOrder> > <phaseOrder type="INfaultflow"> > <phase name="PreDispatch"/> > <phase name="Dispatch" > class="org.apache.axis2.engine.DispatchPhase"> > <handler name="RequestURIBasedDispatcher" > > class="org.apache.axis2.engine.RequestURIBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="SOAPActionBasedDispatcher" > > class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="AddressingBasedDispatcher" > > class="org.apache.axis2.engine.AddressingBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="SOAPMessageBodyBasedDispatcher" > > class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"> > <order phase="Dispatch"/> > </handler> > <handler name="InstanceDispatcher" > class="org.apache.axis2.engine.InstanceDispatcher"> > <order phase="PostDispatch"/> > </handler> > </phase> > <!-- user can add his own phases to this area --> > <phase name="OperationInFaultPhase"/> > </phaseOrder> > <phaseOrder type="Outfaultflow"> > <!-- user can add his own phases to this area --> > <phase name="OperationOutFaultPhase"/> > <phase name="PolicyDetermination"/> > <phase name="MessageOut"/> > </phaseOrder> > </axisconfig> >
