One, the day before the summary
The day before we talked about how to build a Axis2 webservice, how to do it, and 4 different clients: Classic, non-blocking, duplex mode, duplex non-blocking.
And we see a AXIS2 Web Service description of the layout:
<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>
This description represents our Web service method that has one or two parameters, and is a Axis2-specific "omelement" type.
So, we want a simple Java type such as a public String SayHello (string name) to write our WebService, OK?
Of course, it's just that our layout description is slightly different from our client call return value.
Ii. writing our webservice using simple Java types
Hellojava class:
Package org.sky.axis2.helloworld.javatype;
Import javax.xml.stream.XMLStreamException;
Import org.apache.axiom.om.OMElement;
public class Hellojava {
public string SayHello (string name) throws Xmlstreamexception {
StringBuffer Hello = new StringBuffer ();
Hello.append ("Hello:");
Hello.append (name);
return hello.tostring ();
}
}
Service description File:
At this point, our corresponding file is service.xml file content slightly different, to see
<service name= "Hellojava" >
<parameter name= "ServiceClass" locked= "false" >
Org.sky.axis2.helloworld.javatype.HelloJava
</parameter>
<messageReceivers>
<messagereceiver mep= "Http://www.w3.org/2004/08/wsdl/in-out"
class= "Org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<actionMapping>urn:sayHello</actionMapping>
</service>