Reputation: 309
I need to consume a SOAP WebService in my application, so I got the WSDL file to generate the needed classes with help of wsimport. The problem is that during parsing I get the following error:
[ERROR] invalid extension element: "soap:body" (in namespace "http://schemas.xmlsoap.org/wsdl/soap/")
I tried the -extension flag but without success.
Has anyone ran into a similar problem in the past? And if yes, how did you solve it?
Upvotes: 1
Views: 1584
Reputation: 10931
Not sure if this is the whole fault...
Trying wsimport
against that simpler WSDL returned:
[ERROR] invalid extension element: "soap:header" (in namespace "http://schemas.xmlsoap.org/wsdl/soap/")
The error message doesn't give the location, but the problem is the <soap:header>
and <soap:body>
under the parent <fault>
:
<fault name="Error">
<soap:header message="sm:GetSeatMapCountsErrorOutput" part="header" use="literal"/>
<soap:header message="sm:GetSeatMapCountsErrorOutput" part="header2" use="literal"/>
<soap:body parts="body" use="literal" />
</fault>
Typically this would be something more like:
<fault name="Error">
<soap:fault name="Error" use="literal" />
</fault>
It looks like this is correct in the link in the earlier comment (http://ws.e-podroznik.pl/?wsdl). Perhaps this has been fixed since?
To get a clue as to where the invalid <soap:header>
is in the message, one trick is to use wsimport -Xdebug
, which will include a stack trace for the exception in the output:
Caused by: com.sun.tools.ws.wsdl.framework.ParseException: invalid extension element: "soap:header" (in namespace "http://schemas.xmlsoap.org/wsdl/soap/")
at com.sun.tools.ws.wsdl.parser.Util.fail(Util.java:186)
at com.sun.tools.ws.wsdl.parser.SOAPExtensionHandler.handleFaultExtension(SOAPExtensionHandler.java:413)
at com.sun.tools.ws.api.wsdl.TWSDLExtensionHandler.doHandleExtension(TWSDLExtensionHandler.java:87)
The clue in there is the SOAPExtensionHandler.handleFaultExtension()
, which indicates the problem is under the parent <fault>
element.
Similarly it could have been handleBindingExtension()
under <binding>
, handleOperationExtension()
under <operation>
, etc.
Upvotes: 1