1.

新建工程

接口
package com.ly.ws;
public interface AddI {
public int add(int a,int b);
}接口实现类
package com.ly.ws.impl;
import com.ly.ws.AddI;
public class AddImpl implements AddI{
public int add(int a,int b){
return a+b;
}
}

Axis2.war形式,部署服务器中发布webservice接口_xml

2.

Axis2.war形式,部署服务器中发布webservice接口_参数测试_02

3.

Axis2.war形式,部署服务器中发布webservice接口_部署服务器中发布webservice接口_03

4.services.xml

<?xml version="1.0" encoding="UTF-8"?>  
<!-- webService发布名称,命名空间 -->
<service name="addService" scope="application" targetNamespace="http://ws.ly.org/ax2">
<!-- 更改schemaNamespace,也可使用默认值,客户端调用时会使用 -->
<!-- webService描述 -->
<description>Web Service实例一</description>
<!-- webService的实现类 -->
<parameter name="ServiceClass">com.ly.ws.impl.AddImpl</parameter>
<!-- 配置消息接收器,Axis2会自动选择 -->
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
</service>

5.获得wsdl文件

​http://127.0.0.1:8080/axis2/services/addService?wsdl​

Axis2.war形式,部署服务器中发布webservice接口_参数测试_02

6.输入参数测试

​http://127.0.0.1:8080/axis2/services/addService/add?a=10&&b=10​

Axis2.war形式,部署服务器中发布webservice接口_部署服务器中发布webservice接口_05