• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can Message Handlers modify SOAP Body ?

 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Message Handlers modify SOAP Body ?

I remember reading that SOAP intermediaries (a.k.a Message Handlers) cannot change the Body part of a SOAP Message.

Please correct me if I am wrong. I am confused after reading "Handler Scenarios" in MZ's guide that says Handlers must be able to transform just parts of the body.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JAX-RPC 1.1 specification on page 106 states:

The handleRequest, handleResponse and handleFault methods for a SOAP message
handler get access to the SOAPMessage from the SOAPMessageContext. The
implementation of these methods can modify the SOAPMessage including the headers and body elements.
 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, Valentin !

In the mean time, I cross-checked with the book "J2EE Web Services" by Richar Monson-Haefel. It says
Neither SOAP 1.1 nor the BP explicity prohibits intermediaries from modifying the contents of the Body element. As a result, the ultimate reciever has no way of knowing if the application specific data has changed somewhere along the message path. SOAP 1.2 reduces this uncertainty by explictly prohibiting certain intermediaries, called forwarding intermediaries, from changing the contents of the Body element and recommeding that all other intermediaries, called active intermiediaries, use a header block to document any chances to the Body element.


So, looks like JAX-RPC message handlers fall under "active intermediaries". Any idea if JAX-RPC Message handlers can be mde "forwarding intermediaries" ?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the purpose of this exam, you should only consider SOAP 1.1, and thus, there is no need to make any disctinction between "active intermediaries" and "forwarding intermediaries"
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In reality, it is not uncommon to find message handlers manipulating the body. Repsponse caching is one example where a handler caches outgoing responses( in handleResponse ) and uses the cached responses to intelligently parse the incoming message( in handleRequest ). If match found, the handleRequest can either tag the SOAP body with response as the hint to the ultimate receiver, or even better, simply send the response back to the client skipping actual end point invocation.

HTH.
 
Rr Kumaran
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith -

As you say
"If match found, the handleRequest can either tag the SOAP body with response as the hint to the ultimate receiver, or even better, simply send the response back to the client skipping actual end point invocation."

can you please explain this sentence clearly ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic