First, let's review the Web service framework-axis, axis2, cxf, and xfire. Next, we will study the framework practice. In fact, the current stage is mainly to practice and apply it.
As mentioned in the previous blog, axis2 and cxf, the two most popular WebService frameworks in Apache, will introduce these two frameworks and solve their problems. There are also questions, and you need expert advice. If you are not familiar with axis2 release and WebService calling, you can follow this development document step by step. Download the specific instance of axis2 development. In this blog, the source code is no longer pasted. A small example similar to the above development document is just that the method parameters are different. The publishing and calling processes are the same. Axis2 server, published service method: configure the services. xml file. In the configuration file, configure and publish the WebService name, the interfaces provided by the Service, and the exposed functions. The file is 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 an error occurs during the test: Org. apache. axis2.axisfault: The serviceclass object does not implement the required method in the following form: omelement getdocsummary (omelement e) indicates that messagereceiver is not set for the method. The configuration is 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 >
Please advise ????:
In the WSDL generated by the axis2 release service, if no return value is returned: the element does not have the corresponding response; if the parameter is null and the return value is returned, the element does not have the corresponding method; if the parameter is null, if the returned value is empty, no element exists and the message is empty.For example, there is a method in the Publishing Service class:
PublicString
Test (){
Return"Test ";}
PublicString
Saysorry (string name ){
Return"Sorry," + name + ".";}
The generated WSDL is as follows: there is no parameter in the test method, so there is no element of the input parameter. If there is no returned value, there is no response element. But the strange thing is that, during my internship at the company, the axis2 service used in the company has no parameters, but there are still elements. Except that the element is empty. Axis2 is also used when the Java client is released in the company. However, the generated WSDL is different. Do you still need to configure it? This problem needs to be solved ...... I always thought that no matter what framework, publish service, the generated WSDL is the same. Actually not. It can only be noted that the WSDL has the same general direction. Type, message, bind, and service. But the specific style is different. Especially the element in type. But don't worry. We 'd better follow w3school standards. In this way, different languages can call each other conveniently.
You have another question to ask.Axis2 transmits parameters of complex types. In the axis2 client, the list type cannot be passed because the list <string> type is not supported, not to mention the custom object. A solution provided on the Internet is to wrap the list into an object again, 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 ;}} but in the RPC format, the returned value cannot be converted to a custom object. The error is as follows: Org. apache. axiom. om. impl. lolom. the omtextimpl cannot be converted to the list. Someone solved the problem. But I tried it incorrectly. Is it a configuration problem or a missing step? In fact, there are many ways to publish services and call axis2. RPC is the most common and direct method, but RPC cannot pass complex types and custom object parameters.