spring-cloud-contract
spring-cloud-contract copied to clipboard
The problem with child node's XML namespaces
Describe the bug I want to write tests in Kotlin for an SOAP service and there is a problem with child namespaces. Child node's namespaces break the application during build.
Sample
response {
body = body ("""
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:Res xmlns:ns2="http://*******/****/****/******/schema">
<ns2:ID>1</ns2:ID>
</ns2:Res>
</soap:Body>
</soap:Envelope>""")
}
Possible problem Class: org.springframework.cloud.contract.verifier.util.xml.DOMNamespaceContext
method:
private void addNamespaces (Node element) {
if (element.getParentNode ()! = null) {
addNamespaces (element.getParentNode ());
}
if (element instanceof Element) {
Element el = (Element) element;
NamedNodeMap map = el.getAttributes ();
for (int x = 0; x <map.getLength (); x ++) {
Attr attr = (Attr) map.item (x);
if ("xmlns" .equals (attr.getPrefix ())) {
namespaceMap.put (attr.getLocalName (), attr.getValue ());
}
}
}
}
As you can see, it only parses namespaces from the root (soap: Envelope) node. All namespaces declared in child nodes are ignored.
Hi! Are you willing to file a fix for this issue?
Hi! Are you willing to file a fix for this issue?
Hello, sorry, but I'm afraid I can't. Hope you will fix it when you have time
Any updates on this? If not Can I give it a try?