使用骆驼通过 http 发送普通肥皂
Send plain soap over http using camel
我正在尝试设置一个非常简单的路由来通过 http 发送 SOAP 内容,然后显示响应:
<route>
<from uri="direct:start"/>
<setBody>
<constant><![CDATA[<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"><SOAP:Header></SOAP:Header><SOAP:Body></SOAP:Body></SOAP:Envelope>]]>
</constant>
</setBody>
<to uri="https://localhost:8443/api"/>
<log message="${out.body}"/>
</route>
我没有收到任何错误,但没有真正显示响应。
我在这里错过了什么?
我只是像这样运行我的应用程序:
public class App {
public static void main( String[] args ) {
ApplicationContext
ctx = new ClassPathXmlApplicationContext("META-INF/spring/camel-config.xml");
}
}
您还没有设置一些headers。
尝试如下修改您的路线:
<route>
<from uri="timer://foo?fixedRate=true&period=60000"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-type">
<constant>text/xml;charset=UTF-8</constant>
</setHeader>
<setHeader headerName="Accept-Encoding">
<constant>gzip,deflate</constant>
</setHeader>
<setBody>
<constant><![CDATA[<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"><SOAP:Header></SOAP:Header><SOAP:Body></SOAP:Body></SOAP:Envelope>]]>
</constant>
</setBody>
<to uri="https://localhost:8443/api"/>
<log message="${out.body}"/>
</route>
我已经更改了路由的开头,因为我不知道您如何向 direct:start
发送消息。
我正在尝试设置一个非常简单的路由来通过 http 发送 SOAP 内容,然后显示响应:
<route>
<from uri="direct:start"/>
<setBody>
<constant><![CDATA[<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"><SOAP:Header></SOAP:Header><SOAP:Body></SOAP:Body></SOAP:Envelope>]]>
</constant>
</setBody>
<to uri="https://localhost:8443/api"/>
<log message="${out.body}"/>
</route>
我没有收到任何错误,但没有真正显示响应。
我在这里错过了什么?
我只是像这样运行我的应用程序:
public class App {
public static void main( String[] args ) {
ApplicationContext
ctx = new ClassPathXmlApplicationContext("META-INF/spring/camel-config.xml");
}
}
您还没有设置一些headers。
尝试如下修改您的路线:
<route>
<from uri="timer://foo?fixedRate=true&period=60000"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-type">
<constant>text/xml;charset=UTF-8</constant>
</setHeader>
<setHeader headerName="Accept-Encoding">
<constant>gzip,deflate</constant>
</setHeader>
<setBody>
<constant><![CDATA[<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"><SOAP:Header></SOAP:Header><SOAP:Body></SOAP:Body></SOAP:Envelope>]]>
</constant>
</setBody>
<to uri="https://localhost:8443/api"/>
<log message="${out.body}"/>
</route>
我已经更改了路由的开头,因为我不知道您如何向 direct:start
发送消息。