HTTP Post From ActiveMQ using Camel

别说谁变了你拦得住时间么 提交于 2019-12-01 06:50:42

I found the answer. To fix, I had to add the Content Type node to the header and set the body to a name/value pair, as shown below:

<route errorHandlerRef="dlc" autoStartup="true" inheritErrorHandler="true" id="route2" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="http://camel.apache.org/schema/spring">
    <from uri="activemq:test"/>
    <setBody inheritErrorHandler="true" id="setBody2">
        <simple>name=${body}</simple>
    </setBody>
    <setHeader headerName="Content-Type" inheritErrorHandler="true" id="setHeader3">
        <constant>application/x-www-form-urlencoded;</constant>
    </setHeader>
    <setHeader headerName="CamelHttpMethod" inheritErrorHandler="true" id="setHeader4">
        <constant>POST</constant>
    </setHeader>
    <to uri="http://localhost/tim/camel/" inheritErrorHandler="true" id="to2"/>
</route>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!