The path to the architect 11th day Axis2 Web Service (ii)

Source: Internet
Author: User
Tags stringbuffer

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.