Should I remove the namespace from this document?

Should I remove the namespace from this document?

Based on my reading, SOAP namespaces are used to distinguish between different elements that share the same local name and that reside in the same XML document. I have an XML document (see sample below) in which all the elements have unique names. Should I remove the namespace from the document?

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to keep you informed on recent service-oriented architecture (SOA) and SOA-related topics such as integration, governance, Web services, Cloud and more.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSOA.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSOA.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.


<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<inquiry xmlns="urn:revcol" messageTime="Wed Jul 24 13:39:24 EDT 2002">
<categoryCode>1010</categoryCode>
<accountNum>1111111111111</accountNum>
<customerName>John Doe</customerName>
<customerAddress>123 Street Dallas Texas 12345</customerAddress>
<customerPhone>1234567890</customerPhone>
</inquiry>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Note that the inquiry start-tag creates a default namespace url:revcol. As a consequence, tools that automatically expand XML namespaces will change the information associated with the categoryCode, accountNum and other elements contained within the inquiry element.

Namespaces (unfortunately) have two main effects. The first is to give a mechanism for disambiguating names. The second is to create an inheritance hierarchy through the use of default namespaces.

So, in a word, 'no'. Best not to remove the namespace as it would result in changing the meaning of the XML document for namespace-aware processors.

This was first published in September 2003