axis2通过services.xml配置文件发布的两种方式

前端之家收集整理的这篇文章主要介绍了axis2通过services.xml配置文件发布的两种方式前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

接口如下

package com.wm5920.webservice;  
public class HelloService {            
    public String sayHello(){  
        return "hello";  
    }             
    public String sayHelloToPerson(String name){       
        if(name==null){  
            name = "nobody";  
        }             
        return "hello,"+name;  
    }  
    public void updateData(String data){  
        System.out.println(data+" 已更新。");  
    }  
} 

services.xml配置一:

<?xml version="1.0" encoding="UTF-8"?>  
<service name="HelloService">  
    <description>  
        Web Service例子  
    </description>  
    <parameter name="ServiceClass">  
        com.wm5920.webservice.HelloService  
    </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>

services.xml配置二:

<service name=" HelloService">  
<description>  
    Web Service例子  
</description>  
<parameter name="ServiceClass">  
    com.wm5920.webservice.HelloService    
</parameter>  
<operation name="sayHello">  
    <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>  
</operation>  
<operation name="sayHelloToPerson">  
    <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>  
</operation>  
<operation name="updateData">  
    <messageReceiver  
        class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>  
    </operation>  
</service> 
第二种要多写具体方法,建议用第一种! 原文链接:https://www.f2er.com/xml/296675.html

猜你在找的XML相关文章