简体   繁体   English

使用骆驼在HTTP上发送普通肥皂

[英]Send plain soap over http using camel

I am trying to set up a very simple route to send SOAP content over http and then show the response: 我正在尝试建立一个非常简单的路由来通过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>

I am not getting any error but is not really showing the response. 我没有收到任何错误,但未真正显示响应。

What am I missing here? 我在这里想念什么?

I am simply runnig my app like this: 我只是像这样运行我的应用程序:

public class App {
    public static void main( String[] args ) {
        ApplicationContext
                ctx = new ClassPathXmlApplicationContext("META-INF/spring/camel-config.xml");
    }
}

You have not set some headers. 您尚未设置一些标题。

Try to modify your route like below: 尝试如下修改您的路线:

 <route>
     <from uri="timer://foo?fixedRate=true&amp;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>  

I have changed the beginning of the route, because I don't know how you're sending messages to direct:start . 我已经更改了路线的起点,因为我不知道您是如何向direct:start发送消息的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM