Soap 从Apache Camel使用CXF服务返回空正文

Soap 从Apache Camel使用CXF服务返回空正文,soap,apache-camel,camel-cxf,Soap,Apache Camel,Camel Cxf,我已经使用SpringDSL在Camel中实现了一个简单的SOAP服务消费者。我将它定向到我在SoapUI中运行的模拟服务,这样我就可以看到传入的请求和返回的响应。我还配置了日志拦截器。我观察到的是SoapUI接收到的请求,响应作为SOAP信封返回并记录在日志拦截器中,带有正确的数据,但是当我尝试在CXF调用之后记录正文时,它是空的(不是null,只是一个空字符串)。 以下是我的配置: <cxf:cxfEndpoint id="soapEndpoint"

我已经使用SpringDSL在Camel中实现了一个简单的SOAP服务消费者。我将它定向到我在SoapUI中运行的模拟服务,这样我就可以看到传入的请求和返回的响应。我还配置了日志拦截器。我观察到的是SoapUI接收到的请求,响应作为SOAP信封返回并记录在日志拦截器中,带有正确的数据,但是当我尝试在CXF调用之后记录正文时,它是空的(不是null,只是一个空字符串)。 以下是我的配置:

<cxf:cxfEndpoint id="soapEndpoint"
                 address="http://localhost:8088/mockServiceSoapBinding"
                 wsdlURL="wsdl/blah.wsdl"
                 serviceClass="my.schema.MyServicePortType"
                 endpointName="s:MyServicePort"
                 serviceName="s:MyService"
                 xmlns:s="http://com.foo">
    <cxf:outInterceptors>
        <ref bean="loggingOutInterceptor"/>
    </cxf:outInterceptors>
    <cxf:inInterceptors>
        <ref bean="loggingInInterceptor"/>
    </cxf:inInterceptors>
    <cxf:properties>
        <entry key="dataFormat" value="POJO"/>
    </cxf:properties>
</cxf:cxfEndpoint>

<camelContext id="main" xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="jetty:http://localhost:8181/callSoap"/>

        <setBody>
            <groovy>
                body = new MyRequest();
                ... populate the object here ...
                return body;
            </groovy>
        </setBody>

        <setHeader name="operationName">
            <constant>sendRequest</constant>
        </setHeader>
        <setHeader name="operationNamespace">
            <constant>http://com.foo</constant>
        </setHeader>

        <log message="****************** BEFORE CXF CALL ${body}" loggingLevel="INFO"/>

        <to uri="cxf:bean:soapEndpoint"/>

        <log message="****************** AFTER CXF CALL ${body}" loggingLevel="INFO"/>
    </route>
</camelContext>

body=newmyrequest();
... 在此处填充对象。。。
返回体;
发送请求
http://com.foo
以下是日志的相关部分:

11:39:47.123 [default-workqueue-1] INFO  o.a.c.s.P.P.MyServicePortType - Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=utf-8
Headers: {Content-Length=[640], content-type=[text/xml; charset=utf-8], Server=[Jetty(6.1.26)]}
Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://com.foo">
   <soapenv:Header/>
   <soapenv:Body>
      <ns0:MyResponse>
      <!-- SOME XML HERE -->
      </ns0:MyResponse>
   </soapenv:Body>
</soapenv:Envelope>
--------------------------------------
11:39:47.168 [default-workqueue-1] INFO  route1 - ****************** AFTER CXF CALL 
11:39:47.123[default-workqueue-1]信息o.a.c.s.P.P.MyServicePortType-入站消息
----------------------------
身份证号码:1
响应代码:200
编码:UTF-8
内容类型:text/xml;字符集=utf-8
标题:{Content Length=[640],Content type=[text/xml;charset=utf-8],Server=[Jetty(6.1.26)]}
有效载荷:
--------------------------------------
11:39:47.168[default-workqueue-1]信息路由1-******************在CXF调用后
我做错了什么?

好的,我有点明白了,我添加了以下代码:

<bean id="prepareResponse" class="com.dummy.PrepareResponse"/>
<process ref="prepareResponse"/>
@Override
    public void process(Exchange exchange) throws Exception {
        Object[] result = exchange.getIn().getBody(Object[].class);
        exchange.getOut().setBody(result[0]);
    }