1. First download the Axis2.war file, the conf,lib,modules three folders inside copy to the project Web-inf, delete the txt file inside Lib:
2. Create a services directory under Web-inf and create a meta-inf under the service directory, and then change the new services.xml in the directory
3. Developing Java classes:
Package Xihuyu.service; Public class { public string SayHello (string name) { return "Hello" + name;< c14/>}}
4. Writing Services.xml
<Servicename= "Axisservice"> <Description>Axisservice</Description> <parametername= "ServiceClass">xihuyu.service.Calculate</parameter> <Operationname= "SayHello"> <Messagereceiverclass= "Org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> </Operation></Service>
5. In the Web. XML Configuration Axis2
<servlet> <Servlet-name>Axisservlet</Servlet-name> <Servlet-class>Org.apache.axis2.transport.http.AxisServlet</Servlet-class> <Load-on-startup>1</Load-on-startup> </servlet> <servlet-mapping> <Servlet-name>Axisservlet</Servlet-name> <Url-pattern>/services/*</Url-pattern> </servlet-mapping>
6. Launch our web project, browser input: http://localhost:8177/MyAxis/services/AxisService?wsdl
You can see that the WSDL that accessed us was successful.
Publishing WS services using AIXS2