'Java - How to get rid of namespaces within Soap Requests (ns2)
I am using JAXB to print out the XML string that corresponds to the Soap UI request that my code is generating. For whatever reason, JAXB is automatically placing "ns2" namespaces in the opening and closing tags of my generated request, which consequently leads to a SoapFault error.
For context this is how my generated request looks like:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:com.unsolicited.notifications">
<soapenv:Header/>
<soapenv:Body>
<urn:sendUnsolicitedNotification>
<ns2:UnsolicitedNotificationRequest xmlns:ns2="urn:com.unsolicited.notifications.bo">
<otherInfo>
<key>clientEmail</key>
<value>[email protected]</value>
</otherInfo>
<otherInfo>
<key>emailBody</key>
<value>This is my email body</value>
</otherInfo>
</ns2:UnsolicitedNotificationRequest xmlns:ns2="urn:com.unsolicited.notifications.bo">
</urn:sendUnsolicitedNotification>
</soapenv:Body>
</soapenv:Envelope>
As you can see the opening and closing tags for UnsolicitedNotificationRequest has ns2 namespaces which I would like to get rid of.
Solution 1:[1]
When you say failing, is it failing an assertion you have against the test step because of the namespace? If so, there is a checkbox in the assertion window named something like "Ignore Namespace Prefixes?", which does exactly that.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chris Adams |
