Skip to Content
Author's profile photo Attila Mikulan

Qualified and unqualified namespaces in SOAP XMLs

In this post I’d like to explain, how namespaces work in SOAP requests and responses. A typical error when calling webservices, is that the external partner (either provider, or consumer of a SAP service) doesn’t send the SOAP XML with elements in proper namespaces. The reason is usually the lack of usage of namespace prefixes. SAP ABAP Web service framework always generates XMLs with qualified namespaces, which is the recommended way by W3C.

What is qualified and unqualified?

In this example (source: -> XML schema Element), the schema components (element name, type) in the namespace are unqualified and those for (mystring) are qualified with the wsc prefix:

<schema xmlns=""
<element name="fname" type="wsc:mystring" />

The major difference

If there is a namespace declaration anywhere in the XML file, it is available for that element and all elements in its child tree.

Unqualified: If you declare a namespace without using a prefix (unqualified), the default namespace is changed. This means, that all elements without a namespace prefix will be in that specific namespace in the child tree of that element.

Qualified: When using qualified namespace declaration, you define a namespace prefix (like a reference) and only those elements will be in that namespace, that have the specified prefix. The default namespace is not changed, therefore elements without prefixes remain in empty namespace.


Case 1: Using prefixes (qualified namespaces)

<ns1:Calculator xmlns:ns1="calc:test:namespace">

Here only Calculator is in the “calc:test:namespace” namespace, with the prefix ‘ns1’. Input and Operation are in empty namespace.

Case 2: No prefixes (unqualified namespaces)

<Calculator xmlns="calc:test:namespace">

In this example all elements are in the “calc:test:namespace” namespace, including Calculator, Input and Operation. The reason, is that the default namespace has been changed by the unqualified namespace declaration for all child elements as well. Therefore elements without prefix are also in this namespace.

Without using prefixes, the empty namespace should be declared to all child elements to make it equal to the previous case. Here is how:

<Calculator xmlns="calc:test:namespace">
<Input xmlns="">2</Input>
<Operation xmlns="">squareroot</Operation>

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Antonio Lozada
      Antonio Lozada