Call WebService Exception Summary

Source: Internet
Author: User

Publishing and calling WebService is simple, but the small issues continue to be summarized as follows:


One, Java calls. NET WebService produces "the server failed to recognize the value of HTTP header SOAPAction" error.

Solution:

When WebService is called, no soapaction is specified and no requestnamespace is specified, so the request always occurs when the server fails to recognize the value of the HTTP header soapaction.

If you call with axis, call it as follows:

public static void Main (string[] args) throws Exception {//not with?         WSDL suffix string endpoint = "Http://webservice.webxml.com.cn/webservices/qqOnlineWebService.asmx";        Create a service call (calling) Service service = new service ();            Create call object via service call call Service.createcall ();           Set the URL call.settargetendpointaddress (new Java.net.URL (endpoint)) where the service is located; Qqcheckonline is net over the way "http://WebXml.com.cn/" This also need to pay attention to namespace address, without also error call.setoperationname ("New QName (" http         ://webxml.com.cn/"," Qqcheckonline "));                Qqcode is also the parameter name of the. Net method, that is, the Qqcheckonline parameter name Call.addparameter (new QName ("http://WebXml.com.cn/", "Qqcode"),                Org.apache.axis.encoding.XMLType.XSD_STRING, Javax.xml.rpc.ParameterMode.IN);         Avoid Java calling. NET WebService "The server failed to recognize the value of the HTTP header SOAPAction" error call.setusesoapaction (TRUE); Call.setreturntype (Org.apache.axis.encoding.XMLType.SOAP_STRING);       Returns the type of the parameter Call.setsoapactionuri ("Http://WebXml.com.cn/qqCheckOnline");  It's also important to note that you add the method you want to call, or the error//Object array encapsulates the argument String ret = (String) call.invoke (new object[]            {"AAAAA"});     System.out.println ("--------" +ret);   }

Note the comments section.

Http://webservice.webxml.com.cn/webservices/qqOnlineWebService.asmx? WSDL is public webservice


Second, the following exception occurred when using CXF Wsdl2java.bat to generate a client calling. NET from a WSDL file to publish WebService

(undefined element declaration ' S:schema ')

Solution:

Open Wsdl.xml, with <s:any minoccurs= "2" maxoccurs= "2"/> Replace <s:element ref= "S:schema"/><s:any/>

This Wsdl2java generation error should be related to JAXB not supporting XML ref because <s:any minoccurs= "2" maxoccurs= "2"/> and <s:element ref= "S:schema"/ ><s:any/> is actually equivalent. <s:element ref= "S:schema"/> is actually said here can be used as a s:schema of any element type to replace, <s:any/> is played this role, <s:any minoccurs= "2 "maxoccurs=" 2 "/> is just the two <s:any/> wrote a sentence.

Reference http://blog.sina.com.cn/s/blog_a53901340101cnt5.html


Third, using the CXF wsdl2java.bat based on the WSDL file generation client compilation Super Error

Solution:

Its inability to compile properly is due to the conflict between the jax-ws2.2 statute and the JAVA6.

However, the program can not be compiled with JAVA5 only, it is necessary to reduce the Jax-WS protocol version, it is possible to handle: Execute command
Wsdl2java-frontend jaxws21-client *.xml

The code generated by jax-ws2.1 can then be compiled and executed in JAVA6.

I compared the two generated client code of the tool with the text, and found that the client code generated by the latter was 3 constructors, so removing the 3 constructors of the error could solve the above problem.


The Great Wall is not a day base, continue to accumulate it.


Call WebService Exception Summary

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.