You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by virtualshock <na...@virtualshock.net> on 2009/02/23 05:37:27 UTC

Need to modify the tag

I need to modify the <SOAP:Body> tag on an outgoing message.  I am making a
call to a very non-standard service that requires an attribute to be set in
the <SOAP:Body> tag.  I have looked at some of the various Out interceptors
that are used in CXF but I haven't found an example of what I am looking
for.  Does anyone have any suggestions on where to look for a good example
of modifying document before it gets sent out?  Thanks
-- 
View this message in context: http://www.nabble.com/Need-to-modify-the-%3CSOAP%3ABody%3E-tag-tp22155207p22155207.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Need to modify the tag

Posted by Daniel Kulp <dk...@apache.org>.
On Sun February 22 2009 11:37:27 pm virtualshock wrote:
> I need to modify the <SOAP:Body> tag on an outgoing message.  I am making a
> call to a very non-standard service that requires an attribute to be set in
> the <SOAP:Body> tag.  I have looked at some of the various Out interceptors
> that are used in CXF but I haven't found an example of what I am looking
> for.  Does anyone have any suggestions on where to look for a good example
> of modifying document before it gets sent out?  Thanks

There are three ways to do this:

1) Use a JAXWS handler and manipulate the SAAJ model

2) Stick the SAAJOutInterceptor on the out chain and manipulate the SAAJ model

3) Stick an interceptor on the chain immediately AFTER the SoapOutInterceptor 
that grabs the XMLStreamWriter from the message and just calls:
xmlwriter.writeAttribute(.....);
to write the attribute onto the body.     The last thing SoapOutInterceptor is 
calls writeStartElement for the soap:body so you can add attributes to it at 
that point.

(3) is definitely the highest performing solution.


-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog