Apache的骆驼路由到SOAP API [英] Apache Camel Route to SOAP API

查看:389
本文介绍了Apache的骆驼路由到SOAP API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一些XML数据发布到通过Apache骆驼一个SOAP API。请参阅骆驼航线below.What我想在这里阅读的℃的xml文件:/输入的并发送其内容在我的Tomcat举办的SOAP API(本地主机:8080 /为MyService / soapws)。
是否有可能在这里使用骆驼的HTTP组件?
有在骆驼的任何其它组件,可用于路由到SOAP API。我是新来的骆驼。请帮助

以下是我的xsd的SOAP API

 < XS:架构的xmlns:XS =htt​​p://www.w3.org/2001/XMLSchema将elementFormDefault =合格>    < XS:元素的名称=SOA prequest>
        < XS:复杂类型>
            < XS:序列>
                < XS:元素的名称=payloadXml类型=XS:字符串/>
            < / XS:序列>
        < / XS:复杂类型>
    < / XS:组件>
< / XS:架构>

此外,我所定义的骆驼路线如下

 公共类MyCamelRouter扩展RouteBuilder {@覆盖
公共无效配置()抛出异常{
    从(文件:C:/输入)
        。要(HTTP:本地主机:8080 /为MyService / soapws));
}


解决方案

是的,你可以做到这一点。对于SOAP,你可能需要设置SOAPAction头或东西为好,用

 从(文件:C:/输入)
  .setHeader(SOAPAction的常数(someNameHere))
  。要(HTTP:本地主机:8080 /为MyService / soapws));

您可以使用了SoapUI来尝试调用真正的SOAP服务,然后从了SoapUI可以看到HTTP请求体/头,然后知道,包括为它工作,然后复制,使用骆驼的头/体

I'm trying to post some xml data to a SOAP API through Apache Camel. Please see the Camel route below.What I'm trying here is to read an xml file in C:/input and send its content to a SOAP API hosted at my Tomcat (localhost:8080/myservice/soapws). Is it possible to use Camel's HTTP component here? Is there any other component in Camel that can be used for routing to SOAP API. I'm new to Camel. Please help

Following is my xsd for the SOAP API

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

    <xs:element name="soapRequest">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="payloadXml" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>  
</xs:schema>

Also the Camel route I defined is as follows

public class MyCamelRouter extends RouteBuilder {

@Override
public void configure() throws Exception {
    from("file:C:/input")
        .to("http:localhost:8080/myservice/soapws"));
}

解决方案

Yes you can do that. For SOAP you may need to set the SOAPAction header or something as well, using

 from("file:C:/input")
  .setHeader("SOAPAction", constant("someNameHere"))
  .to("http:localhost:8080/myservice/soapws"));

You can use SoapUI to try calling the SOAP service for real, and then from SoapUI you can see the HTTP request body / headers, and then know what to include for it to work, and then replicate that using Camel's header / body.

这篇关于Apache的骆驼路由到SOAP API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆