'Karate: XML element changed to have empty namespace

when a xml message define like below, karate adds empty namespace to child element.

Karate feature

Feature: test xml
  Scenario: test xml empty namespace
    * def x =
    """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
  <validateEmailAddressRequest xmlns="anotherUri">
    <request>
      <email>[email protected]</email>
    </request>
  </validateEmailAddressRequest>
</soapenv:Body>
</soapenv:Envelope>

    """
    * print x

Output

16:39:17.009 [main] INFO com.intuit.karate - [print] <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <validateEmailAddressRequest xmlns="anotherUri">
         <request xmlns="">
            <email>[email protected]</email>
         </request>
      </validateEmailAddressRequest>
   </soapenv:Body>
</soapenv:Envelope>HTML report: (paste into browser to view) | Karate version: 0.9.4

if you look at the <request> element in the output it's now has the empty namespace where in feature does not.

That does create a problem when SOAP request hitting the server.

Do you know why this behaviour and how can I override it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source