Java Reference
In-Depth Information
Removing a Header from a SOAP Message
Problem
You want to remove a header from a SOAP message. Perhaps you have processed it already
and want to relay the message to the next processor, or you just don't want it taking up unne-
cessary space in the byte stream because you're not using it.
Solution
Use the SOAPHeader.detachNode method.
Discussion
If you know that you won't be using the header section of the envelope, you can remove it to
lighten the load you're sending across the wire. Here is the code to make it happen:
SOAPHeader header = env.getHeader();
header.detachNode();
The resulting SOAP envelope looks like this, just the envelope and the body:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="...">
<SOAP-ENV:Body>...
That's all there is to it.
Search WWH ::




Custom Search