SOAP: WSDL with targetNamespace and messages without namespace prefix parsing issue
driesva opened this issue · 0 comments
driesva commented
We received a WSDL with a targetNamespace
attribute. That namespace has not been added to the WSDL with a prefix (as one usually would do). As such the WSDL contains messages where the parts have elements without namespace prefix.
This can be reproduced with modifying the existing samples in the tests (that have a prefix configured for the tns):
<definitions name="PetService" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:com:example:petstore"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:com:example:petstore">
<!-- ... -->
<message name="getPetByIdRequest">
<part type="xs:string" name="header"/>
<!-- <part element="tns:getPetByIdRequest" name="body"/> -->
<part element="getPetByIdRequest" name="body"/>
</message>
<!-- ... -->
Currently the parsing fails (using latest version 3.39.0):
Caused by: java.lang.IllegalStateException: Invalid 'element' or 'type' attribute for message: getPetByIdRequest
at io.gatehill.imposter.plugin.soap.parser.Wsdl1Parser.getMessage(Wsdl1Parser.kt:276) ~[main/:?]
at io.gatehill.imposter.plugin.soap.parser.Wsdl1Parser.getInputOrOutput(Wsdl1Parser.kt:210) ~[main/:?]
at io.gatehill.imposter.plugin.soap.parser.Wsdl1Parser.getOperation(Wsdl1Parser.kt:188) ~[main/:?]
at io.gatehill.imposter.plugin.soap.parser.Wsdl1Parser.getBinding(Wsdl1Parser.kt:99) ~[main/:?]
at io.gatehill.imposter.plugin.soap.parser.VersionAwareWsdlParser.getBinding(VersionAwareWsdlParser.kt:94) ~[main/:?]
When getting the element attribute, the target namespace should be taken into account in function getAttributeValueAsQName