I'm not sure about the Utils.toCxfPayLoad doing.
Here is an example[1] that could help you out.

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadTest.java

On 3/21/11 10:19 AM, hyjshanghai wrote:
I made some corrections for the following text.
I am using Camel 2.4.0. Below is the code of the end processor and the log
output.

public class EndProcessor implements Processor {
     private static final Logger _LOGGER =
LoggerFactory.getLogger(EndProcessor.class);

     @Override
     public void process(Exchange exchange_) throws Exception {

         // I try to set both in and out messages.
         exchange_.getIn().setBody(generateResponse(exchange_));
         exchange_.getOut().setBody(generateResponse(exchange_));
                
        // Logging. The log output is shown below. Utility.exchange2String() 
simply
prints the properties, in and out messages of an Exchange
        _LOGGER.debug("End proccessor. exchange: \nhas out: 
"+exchange_.hasOut()+"
original pattern: " + exchange_.getPattern().name() + "\n" +
Utility.exchange2String(exchange_));
                
         return;
     }

     @SuppressWarnings("unchecked")
     private static CxfPayload generateResponse(Exchange exchange_) throws
Exception
     {
         String value = "<Response>hello</Response>";

        // Build Cxfpayload object from XML in the way mentioned in the previous
post.
         return Utils.toCxfPayload(value);
     }
}

The log output when executing the processor:

10:00:19.134 [33165064@qtp-12758948-0 - /SoapContext/SoapPort] DEBUG
c.m.q.aaa.XX.YY - End proccessor. exchange:
has out: true original pattern: InOut
properties: {CamelToEndpoint=http:// ... ,
RequestContext=org.apache.cxf.jaxws.context.WrappedMessageContext@10f9de8,
org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo:
{http:// ... }execute], CamelCXFDataFormat=PAYLOAD}
in: Message: org.apache.camel.component.cxf.CxfPayload headers: nullbody: [
[<Response>hello</Response>]]
out: Message: org.apache.camel.component.cxf.CxfPayload headers: nullbody: [
[<Response>hello</Response>]]

Finally, I am poor to get only an empty body in the SOAP response displayed
in the XML sender plug-in of Eclipse IDE...





--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-Get-SOAP-Response-from-the-Last-Camel-Processor-in-the-Route-tp4127850p4169731.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

Reply via email to