• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When the default namespace is an empty string?

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just wondering what it means exactly when the default namespace is empty?

For example, consider this SOAP fault?



What exactly is the significance of xmlns=""?

Is it needed?
In what situations would you use it?

Thanks.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML namespace says under the Namespace undeclaration section -

When an element carries the attribute xmlns="", the default namespace for that element and its descendants reverts to "no namespace": that is, unprefixed names are considered not to be in any namespace.


It's interesting because it means that the faultcode and the faultstring elements are considered not to be in any namespace.

If we look at the Schema defined in the SOAP Version 1.2 Part 1 specification, these elements do belong to the http://www.w3.org/2003/05/soap-envelope namespace.

Regards,
Dan
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it be fair to say, then, that whatever software produced that element was in error?
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan Drillich wrote:XML namespace says under the Namespace undeclaration section -

When an element carries the attribute xmlns="", the default namespace for that element and its descendants reverts to "no namespace": that is, unprefixed names are considered not to be in any namespace.


It's interesting because it means that the faultcode and the faultstring elements are considered not to be in any namespace.

If we look at the Schema defined in the SOAP Version 1.2 Part 1 specification, these elements do belong to the http://www.w3.org/2003/05/soap-envelope namespace.

Regards,
Dan


Note totally with you Dan. If we look at Schema defined in the SOAP Version 1.2 Part 1 specification.

We see:



and



If faultcode is not part of the namespace, body isn't either?

What is part of the same namespace then?

can you enlighten?

Thanks.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luke Murphy wrote:
If faultcode is not part of the namespace, body isn't either?


As Paul noted, there seems to be a subtle error in the segment you provided; meaning, faultcode should be part of the namespace.

Regards,
Dan

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan Drillich wrote:
Luke Murphy wrote:
If faultcode is not part of the namespace, body isn't either?


As Paul noted, there seems to be a subtle error in the segment you provided; meaning, faultcode should be part of the namespace.

Regards,
Dan



I got the example from the basic profile examples here

Go to:

3.3.3 SOAP Fault Namespace Qualification

The children of the soap:Fault element are local to that element, therefore namespace qualification is unnecessary.

R1001 When an ENVELOPE is a Fault, the element children of the soap:Fault element MUST be unqualified. [/code]

and you'll see


CORRECT:

<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns='' >
<faultcode>soap:Client</faultcode>
<faultstring>Invalid message format</faultstring>
<faultactor>http://example.org/someactor</faultactor>
<detail>
<m:msg xmlns:m='http://example.org/faults/exceptions'>
There were lots of elements in the message that
I did not understand
</m:msg>
</detail>
</soap:Fault>

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic