Hi Aki and Freeman,
Thanks for the help.  The transform didn't work out for me.  It would remove
elements but still leave empty elements like <>.  I don't think it was
designed to strip out an entire response message.  However, I am glad I got
to learn about the transformer.  It is a really great addition to CXF.

I updated my customer interceptor to set a 202 and empty outputstream (this
is based on the TransformOutInterceptor).  In case anyone is interested,
here it is:

public class RemoveSoapMessageForOneWayResponse extends
AbstractSoapInterceptor {

    private static final String OUTPUT_STREAM_HOLDER = 
        TransformOutInterceptor.class.getName() + ".outputstream";
        
    public RemoveSoapMessageForOneWayResponse() {
        super(Phase.PRE_STREAM);
        addBefore(Arrays.asList(StaxOutInterceptor.class.getName(),
AttachmentOutInterceptor.class.getName()));
    }

    @Override
    public void handleMessage(SoapMessage message) throws Fault {
                
        if (null != message.getContent(Exception.class)) {
            return;
        }
        
        OutputStream os = (OutputStream)message.get(OUTPUT_STREAM_HOLDER);
        
        os = convertStringtoStream("");
        
        if (os != null) {
            message.setContent(OutputStream.class, os);
        }

        message.put(Message.RESPONSE_CODE, 202); 
    }

    private static OutputStream convertStringtoStream(String string) {
        byte[] stringByte = string.getBytes();
        ByteArrayOutputStream bos = new
ByteArrayOutputStream(string.length());
        try {
                        bos.write(stringByte);
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        return bos;
    }



--
View this message in context: 
http://cxf.547215.n5.nabble.com/WS-Addressing-and-One-Way-tp5646635p5713326.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to