package service;
public class MyService{
public String getGreeting(String name){
return "您好 " + name;
}
public void update(String data){
System.out.println("<" + data + ">已经更新");
}
}
package service;
public class MyServiceOther{
public String getName(){
return "shihuan";
}
}
在services.xml文件中可以使用如下的配置代码来配置MyService和MyServiceOther类:
<serviceGroup>
<service name="myService">
<description>
Web Service例子
</description>
<parameter name="ServiceClass">
service.MyService
</parameter>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
</messageReceivers>
</service>
<service name="myServiceOther">
<description>
Web Service例子
</description>
<parameter name="ServiceClass">
service.MyServiceOther
</parameter>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
</messageReceivers>
</service>
</serviceGroup>
【注】:myService和myServiceOther就是http://IP:PORT/ProjectName/services/ServiceName?wsdl中?wsdl前
面的那个ServiceName
本例的访问路径应该是:
http://IP:PORT/ProjectName/services/myService?wsdl
和
http://IP:PORT/ProjectName/services/myServiceOther?wsdl