IntelliJ Java IDE
The moose likes Web Services Certification (SCDJWS/OCPJWSD) and the fly likes Can Message Handlers modify SOAP Body ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Services Certification (SCDJWS/OCPJWSD)
Reply Bookmark "Can Message Handlers modify SOAP Body ?" Watch "Can Message Handlers modify SOAP Body ?" New topic
Author

Can Message Handlers modify SOAP Body ?

Kaarthik Sivashanmugam
Greenhorn

Joined: May 29, 2004
Posts: 26
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

Joined: Aug 26, 2001
Posts: 7610
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.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Kaarthik Sivashanmugam
Greenhorn

Joined: May 29, 2004
Posts: 26
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

Joined: Aug 26, 2001
Posts: 7610
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

Joined: Mar 17, 2000
Posts: 5781
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.


Open Group Certified Master IT Architect.
Sun Certified Architect(SCEA).
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
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 ...


RR Kumaran
SCJP 1.4
 
 
subject: Can Message Handlers modify SOAP Body ?
 
Threads others viewed
JAX-RPC with soap header/body
SOAP Attachments in WLS 8.1 using Workshop 8.1
message handlers
Registering Client side SOAP handlers in AXIS
Adding SOAP header to the SOAP message
Two Laptop Bag

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture