我从 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文件?谢谢 ?