wood burning stoves 2.0*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes SOAPFault doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "SOAPFault doubt" Watch "SOAPFault doubt" New topic
Author

SOAPFault doubt

Asit Baran
Greenhorn

Joined: Oct 13, 2008
Posts: 25
According to BP rule
R1001 When a MESSAGE contains a soap:Fault element its element children MUST be unqualified.
CORRECT
<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns='' >
<faultcode>soap:Client</faultcode>
..........
</soap:Fault>
CORRECT [Please let me know if NOT !]
<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' >
<faultcode>soap:Client</faultcode>
..........
</soap:Fault>

Now, in both the cases the child elements of the <soap:Fault> belong to different namespaces. For the first case it belongs to blank namespace and for the second case it belongs to 'http://schemas.xmlsoap.org/soap/envelope/' namespace. Will not this cause any interoperability problem ? Are these valid SOAPFault examples according to BP 1.0?
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
Hi, What is bothering you? It clearly stated in the source you quote :
When a MESSAGE contains a soap:Fault element, that element MUST NOT have element children other than faultcode, faultstring, faultactor and detail.

INCORRECT:

It is incorrect becau, the DIRECT child of the <SOAP:Fault> may be :faultcode, faultstring, faultactor and detail. In this example as a direct child of <SOAP:Fault> element is also :


In the correct example:


the element

is NOT the direct child of <SOAP:Fault> element, but but child of <detail> element, within what it CAN have a declared a new namespace and the elements mapped to that namespace. So , however, it DOES NOT brake a rule, about what element must be a child of <SOAP:Fault> element. <m:Exception> element is a GRANDCHILD of <SOAP:Fault>.
Do you understand now?


Asit Baran
Greenhorn

Joined: Oct 13, 2008
Posts: 25
Thanks for the reply. Actually I'm concerned about the namespace of <soap:Fault>'s child elements.
Case 1
<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns='' >
<faultcode>soap:Client</faultcode>
<faultstring>Invalid message format</faultstring>
</soap:Fault>
Now this is a valid fault message but <faultcode> and <faultstring> belongs to blank namespace because of " xmlns='' "
Case 2
<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<faultcode>soap:Client</faultcode>
<faultstring>Invalid message format</faultstring>
</soap:Fault>
Now this is also a valid fault message but <faultcode> and <faultstring> belongs to 'http://schemas.xmlsoap.org/soap/envelope/' namespace.

Now what a client should expect? Or he just doesn't bother anything about the namespace of those elements (i.e. <faultcode> and <faultstring>)? Any pointer would be appreciated.

Thanks,
Asit
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
<SOAP:Fault> element must be bound to : "http://schemas.xmlsoap.org/soap/envelope/", namespace, and each of its direct children must be bound to the same namespace.
Although there were some differences in unbinding prefixed namespaces, both versions of xml allow you to unbind or remove the already declared {default namespace} by overriding it with another {default namespace} declaration, where the namespace in the overriding declaration is empty.
So if you declare an empty namespace, you'll remove the existing one already bound (replacing it with no namespace), which is in this example "http://schemas.xmlsoap.org/soap/envelope/". According to BP you must have a "http://schemas.xmlsoap.org/soap/envelope/" namespace bound to <SOAP:Fault> and its direct children. So if you discard required namespace it will be incorrect.
Asit Baran
Greenhorn

Joined: Oct 13, 2008
Posts: 25
Thanks for the reply. If I get you right,

<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns='' >
<faultcode>soap:Client</faultcode>
<faultstring>Invalid message format</faultstring>
</soap:Fault>

is NOT a valid SOAP fault according to BP. But in BP 1.0 specification (http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16436064) I found the same example(i.e. Under the header "4.1.3 SOAP Faults and Namespaces") given as CORRECT.
Please let me know if I'm missing anything.

Thanks,
Asit
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
well, you have right. In both BP-1.0 and BP-1.1 stays that elemnts should not be qualified, and declaring an empty namespace 'xmlns=" " ', every qualification previously created, will be discarded. So it is true. this is correct:


Even, that messages I have inspected had NO 'namespace unqulification' of Fault child elements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SOAPFault doubt