Hi

Have a look please at Transform feature, that should be achieved
easily enough by
configuring outDropElements property.
http://cxf.apache.org/docs/transformationfeature.html
In CXF 2.4.1 one has to list all elements to be dropped, which should
be ok for your case, looks like
two simple element siblings need to be dropped;
Aki added a support for deep drops too for incoming payloads, will be
available in 2.4.2; sooner rather later the out transform writer will
follow the suit :-)

Cheers, Sergey

On Tue, Aug 2, 2011 at 6:47 PM, [email protected] <[email protected]> wrote:
> Hi everyone (this is my first post on this mailing-list)
>
> I would like to modify an outgoing SOAP Request. I would like to remove 2
> xml nodes from the Envelope's body. I managed to set up an Interceptor and
> get the generated String value of the message set to the endpoint.
>
> However, the following code does not seem to work as the outgoing message is
> not edited as expected. Does anyone have some code or ideas on how to do
> this?
>
> public class MyOutInterceptor extends AbstractSoapInterceptor {
>
> public MyOutInterceptor() {
>        super(Phase.SEND);
> }
>
> public void handleMessage(SoapMessage message) throws Fault {
>        // Get message content for dirty editing...
>        StringWriter writer = new StringWriter();
>        CachedOutputStream cos  =
> (CachedOutputStream)message.getContent(OutputStream.class);
>        InputStream inputStream = cos.getInputStream();
>        IOUtils.copy(inputStream, writer, "UTF-8");
>        String content = writer.toString();
>
>        // remove the substrings from envelope...
>        content = content.replace("<idJustification>0</idJustification>",
> "");
>        content = content.replace("<indicRdv>false</indicRdv>", "");
>        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
>        outputStream.write(content.getBytes(Charset.forName("UTF-8")));
>        message.setContent(OutputStream.class, outputStream);
> }
>
> Am I missing something? What is a better way to to this?
> It seems too complicated to achieve my pretty simple requirement...
>



-- 
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com

Reply via email to