maven axis2简单部署webservice
1.配置pom.xml
1 <dependency>
2 <groupId>org.apache.axis2</groupId>
3 <artifactId>axis2</artifactId>
4 <version>${axis2.version}</version>
5 </dependency>
6 <dependency>
7 <groupId>org.apache.axis2</groupId>
8 <artifactId>axis2-transport-http</artifactId>
9 <version>${axis2.version}</version>
10 </dependency>
11 <dependency>
12 <groupId>org.apache.axis2</groupId>
13 <artifactId>axis2-transport-local</artifactId>
14 <version>${axis2.version}</version>
15 </dependency>
16 <dependency>
17 <groupId>org.apache.xmlbeans</groupId>
18 <artifactId>xmlbeans</artifactId>
19 <version>2.4.0</version>
20 </dependency>
2.配置service
在webapp/WEB-INF下新建HelloWs/META-INF/services.xml
services.xml代码如下
1 <?xml version="1.0" encoding="UTF-8"?>
2 <serviceGroup>
3 <service name="HelloWs" targetNamespace="http://ws.axis2Example/" >
4 <description>JNLPGenerator service</description>
5 <schema schemaNamespace="http://ws.axis2Example/" />
6 <parameter name="ServiceClass" locked="false">axis2Example.ws.HelloWs</parameter>
7 <operation name="sayHello">
8 <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
9 </operation>
10 </service>
11 </serviceGroup>
3.在源代码目录新增类axis2Example.ws.HelloWs
1 package axis2Example.ws;
2
3 public class HelloWs {
4 public String sayHello(String name) {
5 if (name == null) {
6 return "Hello";
7 }
8 return "Hello, " + name + "!";
9 }
10 }
参考网址:http://maksim.sorokin.dk/it/2011/01/13/axis2-maven-servlets-tomcat/