【发布时间】:2015-08-28 09:28:23
【问题描述】:
我从 uri 中获取 id,并将其作为条件放在我的 sql 请求中 我把结果转换成 XML 格式后
这是函数:
package com.mycompany.camel.blueprint;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
public class Testws {
@GET
@Path("/test/{id}")
@Produces(MediaType.APPLICATION_XML)
public Integer getAssets(@PathParam("id") int id){
return id;
}
}
这是路线:
<camelContext id="camel" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="cxfrs://bean://rsServer"/>
<log message="${body}"/>
<convertBodyTo type="java.lang.Integer"/>
<to uri="sql:select * from customers where id=:#${body}?exchangePattern=InOut&dataSource=moodleDB"/>
</route> </camelContext>
之后的错误:http://localhost:5070/route/test/1
This page contains the following errors:
error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.
如何获取 xml 文档?谢谢?
【问题讨论】:
-
您使用的是什么版本的 apache-camel?你确定这个错误不是因为浏览器试图将响应解释为 XML 并且是无效的 XML?
-
我正在使用 Jboss Fuse ESB
标签: xml web-services rest apache-camel cxfrs