Reprint Address: http://blog.sina.com.cn/s/blog_4c925dca01014y3r.html
A few days ago the company to connect to a foreign company's business functions, the other is provided by the net generated WebService, Antioch in the CXF Wsdl2java command to generate the client's test code, there are the following failure
Wsdltojava Error:thrown by jaxb:undefined Element declaration ' S:schema '
So Antioch (network time and Space) in the online query a lot of information and constantly practice after groping, and finally found the following two kinds of solutions, Hope Antioch (Network time and space) to resolve the process and summary, to other users to solve similar problems, to provide debit and reference role. The first way (still solved with CXF) Step1 Save the Http://test.payserv.net/Paygate/ccservice.asmx?WSDL corresponding content as ccservice.wsdl
here to specifically note that only through the Web page to save as CCSERVICE.WSDL, can not simply copy the page, and then paste into a text file, save as CCSERVICE.WSDL, so even after the following Step2, will still be an error
Step2 First, replace the following in the ccservice.wsdl file with the following <s:element ref= "S:schema"/><s:any/> replaced with <s:anyminoccurs= "2" maxoccurs= "2"/>
After this processing, run again Wsdl2java again reported the following error
Antioch after careful review and analysis, originally in the ccservice.wsdl file, there are queryresponse and queryresponse two name definitions, may be in net webservice is case-insensitive, However, when the WebService client is generated in Java, it is case-sensitive, so the above error is reported. In response to this, Antioch (cyberspace) in the time of the Queryresponse name changed to QueryResponse1, and in All references to Queryresponse in the ccservice.wsdl file are also changed to QUERYRESPONSE1. And then it's going to run and everything OK
Antioch sum up
in the use of CXF wsdl2java command processing NET or other language generated webservice, such as the error, to carefully observe the description of the error information, through their own thinking and query network resources, targeted changes, must be able to solve.
the second way (solved with Axis's WebService framework)
From the test of Antioch (network Time and space), you can generate WEBSERCIE clients without any modification.
However, there are some jar packs required for axis to ensure that axis-generated WebService client code works correctly
Antioch sum up
If you use the CXF Wsdl2java command can not be used to perform normal, you may wish to use the AXIX and other WebService framework to solve the problem, another angle to solve the problem.
Call mode
Ccservice ccservice = new Ccservice ();
Ccservicesoap Ccservicesoap = Ccservice.getccservicesoap ();
Ccservicesoap.query (parameter 1, parameter 2,...);