Web service is implemented with AXIS2, although it is possible to publish Pojo classes directly into a Web service in the Axis2\web-inf\pojo directory, which does not require any configuration, but these Pojo classes cannot be in any package. This may seem inconvenient, and Axis2 also allows the Pojo class with packages to be published as a Web Service.
First implement a Pojo class, the code is as follows:
Package service;
public class MyService
{public
string getgreeting (string name)
{
"hello" + name;
}
public void Update (String data)
{
System.out.println ("<" + Data + "> has been updated");
}
This class has two methods, both of which need to be published as Web service methods. This approach differs from the Pojo class that is placed directly in the Pojo directory. To publish a MyService class as a Web Service, you need a services.xml file that needs to be placed in the Meta-inf directory, which reads as follows:
<service name= "MyService" >
<description>
Web Service Example
</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 >