Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOAP: WSDL with targetNamespace and messages without namespace prefix parsing issue #569

Closed
driesva opened this issue May 14, 2024 · 0 comments · Fixed by #570
Closed

SOAP: WSDL with targetNamespace and messages without namespace prefix parsing issue #569

driesva opened this issue May 14, 2024 · 0 comments · Fixed by #570
Labels

Comments

@driesva
Copy link
Contributor

driesva commented May 14, 2024

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

driesva added a commit to driesva/imposter that referenced this issue May 14, 2024
* Function to resolve the targetNamespace from the WSDL-document. If such a target namespace is declared and e.g. the element attribute of the message part has no namespace prefix, use that target namespace to construct a qualified name.
* Adapt random test WSDLs to have no namespace prefix

fixes outofcoffee#569
outofcoffee pushed a commit to driesva/imposter that referenced this issue May 18, 2024
* Function to resolve the targetNamespace from the WSDL-document. If such a target namespace is declared and e.g. the element attribute of the message part has no namespace prefix, use that target namespace to construct a qualified name.
* Adapt random test WSDLs to have no namespace prefix

fixes outofcoffee#569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants