axis2 web-inf/services目录

来源:互联网 发布:c语言定义一个二维数组 编辑:程序博客网 时间:2024/05/17 23:47

package org.sky.axis2.helloworld; import org.apache.axiom.om.OMElement;import org.apache.axis2.AxisFault; import javax.xml.stream.XMLStreamException; public class HelloWorld {          public OMElement sayHello(OMElement element) throws XMLStreamException {                   element.build();                   // Secondly the OMElement should be detached from the current OMTree so                   // that it can be attached                   // some other OM Tree. Once detached the OmTree will remove its                   // connections to this OMElement.                   element.detach();                   return element;         }}


在我们工程的web-inf/services目录下新建一个目录叫HelloWorld的目录,与我们的类同名,在此目录下再建立一个META-INF的目录(大小写必须完全一致),然后在META-INF目录下新建一个services.xml,

<service name="HelloWorld">         <parameter name="ServiceClass">org.sky.axis2.helloworld.HelloWorld</parameter>    <operation name="sayHello">        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>        <actionMapping>urn:sayHello</actionMapping>    </operation></service>
该部署文件:

(1)它声明了一个WebService的主类:org.sky.axis2.helloworld.HelloWorld

(2)该WebService有一个Web Service Method,在类中该方法名叫sayHello,它返回一个OMElement类型的值 ,接受一个OMElement类型的参数。(RawXMLINoutMessageReceiver)

(3)sayHellow这个对外暴露的WebService方法名为:urn:sayHello。



0 0
原创粉丝点击