问题
I am getting strange parsing error when I try to import a WSDL using wsimport
.
Error:-
org.xml.sax.SAXParseException: Invalid WSDL file: expected {http://schemas.xmlsoap.org/wsdl/}definitions found definitions at line 1)
I checked the WSDL and I am also surprised the first element of it is not
<wsdl:definitions ...>
But rather:
<definitions xmlns:soap="https://schemas.xmlsoap.org/wsdl/soap/" ...>
Could this be the problem? The web service is external, so I dont have any control over the WSDL. One thing I know is that it is generated by JAX-WS 2.1.5. Is it a customized WSDL that my wsimport tool is not able to understand? If yes please tell me how to resolve this problem. Thanks.
回答1:
Based on this conversation, the 2.1.5 version of JAX-WS might have generated an incorrect WSDL and you are using wsimport from a newer version.
回答2:
Do you have following part in the first line of the wsdl?
<definitions ... xmlns="http://schemas.xmlsoap.org/wsdl/">
If not, add it and it should be fine. Reason would be, that the namespace declaration for the wsdl is missing.
来源:https://stackoverflow.com/questions/10537471/wsimport-giving-parse-error