axis2 generates web services

A brief review of the axis2 framework to implement web services

1. First import the lib class library of axis2
2. Load axis2.war into the project release directory of tomcat
3. Simple service provider:
public class FirstService {

public void sayHello(String name){
System.out.println(name);
}
}
4. Create a service description file services.xml

<service name="FirstService" scope="application" targetNamespace="http://firstws.samples/">
    <description>
       First Service
    </description>
    <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>
    <schema schemaNamespace="http://firstws.samples/xsd"/>
    <parameter name="ServiceClass">com.zl. service.FirstService</parameter>
</service>

where targetNamespace is generally the reverse order of the package name (free play)
5. Use ant to compile and package into aar package
6. Publish to TOMCAT_HOME\webapps\axis2\WEB-INF\services (download axis2 -1.4.1-war is published to tomcat)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326768096&siteId=291194637