File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes when to use soap:mustUnderstand= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "when to use soap:mustUnderstand="1" " Watch "when to use soap:mustUnderstand="1" " New topic

when to use soap:mustUnderstand="1"

Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 117

Could you please provide some info, when to use soap:mustUnderstand="1" (in real time example)

Everywhere given comments like, "it will be in header and server has to understand when value is 1", if server cannot understand then it has to generate fault. these comments are not much clear.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
I'll give it a try, though I am not sure I can make it simpler.
Let's say I have four nodes (computers) A, B, C and D.
A client is running on node A, a server on node D. Finally, B and C are intermediary nodes; B passes messages on to C and C on to D.
If the client sends out a header block targeted at node C with the mustUnderstand attribute set to 0, then the client cannot know whether node C chooses to process the message or not.
If the client sends out a header block targeted at node B with the mustUnderstand attribute set to 1 and the client does not receive a fault, then the client can be sure that node B has processed the header block.
The mustUnderstand attribute can be used to force a node to process a header block. This is good if, for instance, the header block contain information that must reach the node.
On the other hand, there may be information that is not essential to the intermediary node. Then mustUnderstand can be set to 0, which allows the node to ignore the header block.
Best wishes!

My free books and tutorials:
Ravi Uppala

Joined: Oct 18, 2011
Posts: 1

Yes that's right. If mustunderstand attribute is 1, any targeted node must process that header if not able to process that header it will generate faultCode "mustUnderstand" and send it to the client.
This is useful in case of implementing security and other meta services to the webservice. we can same receiver act as ultimate receiver and also other role like "Authetication Processor". we can put header info like userId and password for processing by this Authentication Processor, so when it is successfuly processed it will deliver to the real webservice otherwise generate a fault and send it to the client.

Most of the times developers combine authentication in webservice itself but best practice is to have seperate code block and targeted by header.

I hope this gives some more information on header.
Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 117
Nice explanation, thank You both
I agree. Here's the link:
subject: when to use soap:mustUnderstand="1"
It's not a secret anymore!