CXF is a "streaming" stack.  The OutputStream that you removed from the 
message is where you would write your data.    That is most likely a wrapper 
around the HTTP output stream. 

Dan



On Wed September 2 2009 7:56:54 pm rkapur wrote:
> Hi All,
> 
> (I am new to this - so please excuse if I accidentally had a double post.)
> 
> I am unable to set content on the outbound message (from client)
> OutputStream -- basically even though I do
> message.setContent(OutputStream.class, myNewOutputStreamObject) - it does
> not send this to server. It just sits and waits eventually timeout.
> 
> 
> But if I comment out this line ----> factory.getOutInterceptors().add(new
> MessageOutInterceptor());
> then client code send the request and server receives it.
> 
> (I just want to do is change some content in message as the very last step
> before it goes out to the server.) Please point me to right direction.
> 
> Here is the code on client:
> 
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.getOutInterceptors().add(new MessageOutInterceptor());
> factory.setServiceClass(HelloWorld.class);
> factory.setAddress("http://192.168.134.24:9000/HelloWorld";);
> HelloWorld client = (HelloWorld) factory.create();
> 
> System.out.println("going to send message to service.");
> 
> client.echo(pixRequest);
> System.out.println("message sent to service.");
> 
> MessageOutInterceptor Class:
> 
> public class MessageOutInterceptor extends
> AbstractPhaseInterceptor<SoapMessage> {
> 
> public MessageOutInterceptor() {
>         super(Phase.SEND);
>     }
> 
> public void handleMessage(SoapMessage message) {
> 
>    message.removeContent(OutputStream.class);
> 
>     CachedOutputStream cos2 = new CachedOutputStream();
>     cos2.write("test".getBytes());
>     message.setContent(OutputStream.class, cos2);
> }
> 
> }
> 
> 
> Thanks a lot,
> -rishi
> 

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

Reply via email to