Hi,

When you read the stream, you can not be sure that you read all the bytes of message once. You need to use a while to check if you can still read the bytes from stream.

Or you can leverage the Camel type convertor to turn the input stream into a String just like this

String result = exchange.getOut().getBody(String.class);

On 8/21/11 9:22 PM, xiangqiuzhao wrote:
i had send the request message to web services, and the services can execute
successful.

but the camel message's out body is HttpInputStream, and i read from the
stream by

         byte[] b = new byte[4096];
         int len = ((InputStream)exchange.getOut().getBody()).read(b);

output string is "<soap:Envelope xmlns:soap="h", why only 28 bytes readed?
it should be:

<soap:Envelope>
    <soap:Body xmlns:ns1="http://www.wstest.sunyard.com/IWSTestService/";>
       <ns2:helloServiceResponse
xmlns:ns2="http://www.wstest.sunyard.com/IWSTestService/";>
          <value>hello ttt</value>
       </ns2:helloServiceResponse>
    </soap:Body>
</soap:Envelope>

and my request is :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:iws="http://www.wstest.sunyard.com/IWSTestService/";>
    <soapenv:Header/>
    <soapenv:Body>
       <iws:helloServiceRequest>
          <name>ttt</name>
       </iws:helloServiceRequest>
    </soapenv:Body>
</soapenv:Envelope>


--
View this message in context: 
http://camel.465427.n5.nabble.com/send-cxf-message-by-MESSAGE-format-but-can-t-get-response-tp4720445p4720445.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Reply via email to