我正在尝试在JBoss Fuse中为CXF-WS创建一个非常简单的服务,但我对响应消息有疑问。正确调用请求并且spring-camel路由工作正常但响应始终包含空白的“SOAP Body”标记。以下是我对该服务的所作所为:
这是我创建的骆驼路线:
<camelContext xmlns="http://camel.apache.org/schema/spring" >
<!-- Define the CXF End-point -->
<endpoint id="bookMartEndpoint" uri="cxf:http://localhost:8200/OnlineBookMart">
<property key="serviceClass" value="org.jbossfusesamples.bookmart.BookMart" />
</endpoint>
<!-- Define the entity for bookmart set Query -->
<endpoint uri="sql:select * from bookmart" id="getBookQuery" >
<property key="dataSource" value="datasourceBean"/>
</endpoint>
<!-- Define the camel route -->
<route id="WSGateway" >
<from ref="bookMartEndpoint" />
<recipientList>
<simple>direct:${header.operationName}</simple>
</recipientList>
</route>
<!-- Implement the getBook operation -->
<route id="getBookRoute" >
<from uri="direct:getBook"/>
<log message="Route : direct -> getBook" />
<process ref="getBookProcessor" />
<log message="${body}" />
</route>
</camelContext>
这是为处理响应而创建的'getBookProcessor'组件
public class getBookProcessor implements Processor {
//create a logger instance
private static final Logger LOG = LoggerFactory.getLogger(getBookProcessor.class);
@Override
public void process(Exchange exchange) throws Exception {
LOG.info( "Processing getBook interface" );
//create a response element
BookType response = new BookType( );
response.setAuthor("Dummy");
response.setTitle("Dummy");
response.setIsbn("Dummy");
org.jbossfusesamples.book.ObjectFactory oFactory = new ObjectFactory( );
//create the response object from the object factory
exchange.getOut().setBody( (oFactory.createGetBookResponse(response)));
}
}
如果我在这里遗漏任何东西,请告诉我。
答案 0 :(得分:0)
最后这个是固定的,不幸的是,&#39; cxf-rt-transports-http-jetty&#39;与我的camel-cxf版本不兼容。一旦我更新了相同它开始工作。这是我的工作配置
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.15.1.redhat-620133</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version> 3.0.6</version>
</dependency>