Or the knowledge about Axis2 Oh. WebService development, including server development, client development. In the "development of the server side" is usually the deployment of AXIS2 environment, the completion of engineering design and programming, packaging release, generally do not appear abnormal (prerequisite is solid), however, in the "client development" aspect is not good to say. Here's a brief look at the problems that may arise with client development.
1, generate the client code times wrong. For example, using the AXIS2 generation tool to do axis1 wsdl (this can refer to the previous blog, OH), the error message is org.apache.axis2.wsdl.codegen.CodeGenerationException: Java.lang.RuntimeException:java.lang.reflect.InvocationTargetException. The online argument is that there is a problem with WSDL, which is correct, but not detailed enough. Later, the WebService server manufacturer prompted to use the Axis1 generation tool, which solves the problem. Seemingly did not see other friends have such encounters, make mistakes is learning, hehe.
2. AXIS2 generates the WSDL of the CXF webservice. Once encountered a WSDL, and usually see the Axis2 WSDL is a bit different, and finally can be successfully generated client code, that is, stub class. However, to get the stub class, but not as usual to write client-side code (the usual practice is that the new stub class object, the direct invocation of its subclasses, the child method is finished). Later a group of friends to help, just know this is the CSF generated WSDL, enthusiastic group of friends also helped me to generate the CXF client code. But I used Axis2 ah, but still very grateful to him. Later, I asked the manufacturer to take the message, according to the message of the XML (is the SOAP protocol) step-by-step call to solve the problem. Say more is a tear, directly on the code:
The SET value procedure---Note the reference message isppnpiservicestub sub = new Isppnpiservicestub (); Isppnpiservicestub.root rootsend = new Isppnpiservi Cestub.root (); Isppnpiservicestub.msg_head rmsg_head = new Isppnpiservicestub.msg_head (); I Sppnpiservicestub.interface_msg rinterfacemsg = new Isppnpiservicestub.interface_msg (); I Sppnpiservicestub.directive rdirective = new isppnpiservicestub.directive (); Isppnpiservicestub.serviceclass Rserviceclass = new Isppnpiservicestub.serviceclass (); Isppnpiservicestub.servicesubclass rServiceSubClass = new Isppnpiservicestub.servicesubclass (); Isppnpiservicestub.method Rmethod = new Isppnpiservicestub.method (); rMsg_ Head.settime ("string"); Rmsg_head.setfrom ("string"); Rmsg_head.setto ("string"); Rmsg_head.setmsg_type ("string"); Rmsg_head.setserial (ipstring); Rmethod.setname ("Issueppccard");//For messages: <method name= "Issueppccard" > RMETHOD.SETMDN (number); Rmethod.setpwd (pwd); Rservicesubclass.setname ("Csppcmemberservice"); Rservicesubclass.setname ("Csservice"); Rservicesubclass.setmethod (RmetHOD); Rserviceclass.setservicesubclass (Rservicesubclass); Rdirective.setserviceclass (Rserviceclass); Rinterfacemsg.setdirective (rdirective); rootsend.setinterface_msg (rinterfacemsg); Rootsend.setmsg_head (RMsg_head ); Isppnpiservicestub.root Rootrs = Sub. SYNNPIAPI (rootsend, NULL, NULL, NULL, NULL); Isppnpiservicestub.responsesubclass Responsesubclass = new Isppnpiservicestub.responsesubclass (); responsesubclass = Rootrs.getinterface_msg (). Getmsg_response (). Getresponseclass (). Getresponsesubclass (); String returndata = Jsonobject.fromobject (Responsesubclass). toString ();
3. The query timed out. This exception is the Connect timeout, because the server data volume is too large, the query speed is slow, the return data is also more, the entire call process is beyond the default time, the solution is to generate the stub class constructor (there are many oh, don't get it wrong) inside Add this line: _ Serviceclient.getoptions (). Settimeoutinmilliseconds (600000L);//10 mins timeout. This resets the connection time when the stub class is instantiated.
4, there are common nullpointexception, sqlexception and so on, it is estimated that their own code has a problem.
In short: the development of the server is generally not wrong, the client development, the first to ask manufacturers to take the WSDL and URL, the adjustment is not to ask manufacturers to take the message is, if you took the message or how to get it bad? The last trick: give up axis and write the servlet directly (that is, to get javaweb system)!
The veteran does not spray Oh ~ Reprint Please explain from whilejolly:http://blog.csdn.net/seedingly/article/details/39052189
"WebService" 818 exceptions encountered during development of webservice