Apache Camel - 向 http 端点发送 xml 参数不起作用

Apache Camel - sending xml parameter to http endpoint doesnt work

下面是我的路线

    from("activemq:queue:request")
    .routeId("urlRoute")
    .setExchangePattern(ExchangePattern.InOut)
    .convertBodyTo(String.class)
    .to("http://mydomain:8080/my-bin/myProgram.pgm?xmlData=<head><user>username</user><pass>password</pass><data>Some data</data></head>")
    .process(new Processor() {
       public void process(Exchange e) throws Exception {
         log.info("Response : "+MessageHelper.extractBodyAsString(e.getIn()));
       }
     })
    .to("activemq:queue:response")

上面的路由工作正常,因为 to 端点是用 http 端点中的 xml 数据硬编码的....如果我用 ${body} 替换 xml 数据,它就像下面。

.to("http://mydomain:8080/my-bin/myProgram.pgm?xmlData=${body}")

我做的对吗??或者必须定义某些数据类型?请帮帮我..

快速解决方案:

改为:

.recipientList(simple("http://mydomain:8080/my-bin/myProgram.pgm?xmlData=${body}))

好的解决方案:

更改 myProgram.pgm 以接受 XML 由 POST

发送的数据