Whether Axis2 can pass complex type parameter "seek guidance article"

Source: Internet
Author: User
Tags wsdl
    first of all review, the last blog for you to introduce the macro-WebService framework-axis,axis2,cxf,xfire. Next we learn about the framework of practice, in fact, the current stage, mainly will practice, will apply.     and also mentioned in the previous blog that the two most popular webservice frames in Apache--axis2 VS CXF     Then we will be in the next blog on the two broad framework of the introduction and problem solving. Among them, there will be questions, the need for expert advice.          If you do not understand the AXIS2 release and call WebService, you can follow this development document Step-by-step, will certainly be done.       AXIS2 Development Concrete Example Download          that blog, no longer paste the source code, similar to the development of the document, a small example, but the method parameters are different. The process of publishing and calling is the same.     AXIS2 service side, the published service mode:  configure Services.xml file. In the configuration file, configure the publication WebService name, the service-provided interface, and the exposed functions. The documents are as follows:     
   <?xml version= "1.0" encoding= "UTF-8"?>
<serviceGroup>
<service name= "myservice" scope = " Application ">
    <description >
        myservice
    </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 >
   
    <parameter name = "ServiceClass" >
        com.test.UserService
    </parameter >
</service>
</serviceGroup>

If the error occurs during the test process: Org.apache.axis2.AxisFault:The ServiceClass object does not implement the required method in the Foll Owing Form:omelement getdocsummary (omelement e) indicates that the method is not set to Messagereceiver, and is directly configured as follows:
   <messageReceivers>
            <messagereceiver mep= "http://www.w3.org/2004/08/wsdl/in-out"
                class= " Org.apache.axis2.rpc.receivers.RPCMessageReceiver "/>
   </messageReceivers>
Or:
<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 >
  need advice .... in the WSDL generated by the AXIS2 Publishing Service, if there is no return value: The element has no corresponding response; If the argument is null, there is a return value; the element has no corresponding method; If the argument is empty and the return value is empty, then there is no element. And the message is also empty. For example, there is a method in the Publishing service class: PublicString Test () { return"Test";} PublicString Saysorry (string name) { return"Sorry," +name+ "."      ;} The last generated WSDL is as follows: There is no parameter in this test method, so there is no element for the input parameter.     If there is no return value, there is no response element. But strangely, in the company internship, the company used in the AXIS2 issued by the service, no parameters, but still have element. But the element is empty inside.
When the Java side of the company is released, it also uses AXIS2.    But the generated WSDL is different, it needs to be configured, this problem remains to be solved ... It has always been assumed that no matter what the framework, the publishing service, the generated WSDL are the same. Fact Can only be explained, WSDL, the same general direction. Type,message,bind, service four parts. But the specific style is different. Especially the element in type. But don't worry, we'd better write according to W3school specification. So that different languages can be easily invoked between each other. There's one more question to ask.Axis2 A parameter problem that passes a complex type.     The AXIS2 client uses a commonly used RPC form, and it is not possible to pass a List type of,list<string>, let alone a custom object.     One solution on the web is to wrap the list again as an object, so that Axis2 passes the custom object. As follows: Public classuserlist { PrivateList<user> users; PublicList<user> Getusers () { returnUsers; } Public voidSetusers (list<user> users) { This.      Users = Users; However, the return value cannot be converted to a custom object using the RPC form, and the error is as follows: Org.apache.axiom.om.impl.llom.OMTextImpl cannot convert list these two problems, someone solved, but I try incorrectly, is the configuration of the problem or      Missing step. In fact, there are many kinds of AXIS2 publishing services and calling methods. The most common and direct and convenient form of invocation is RPC, but RPC cannot pass complex types and custom object parameters.

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.