我如何使用Apache的骆驼调用SOAP Web服务

问题描述 投票:0回答:2

我有一些服务器的SOAP Web服务的运行。

<wsdl:operation name="lookup">
<wsdl:input message="tns:LookupRequest" name="LookupRequest"> </wsdl:input>
<wsdl:output message="tns:LookupResponse" name="LookupResponse"> 
</wsdl:output>
</wsdl:operation>

它查找一个Web服务,该Web服务将LookupRequest对象作为输入。

所以我的问题是我怎么能叫使用Apache骆驼此查找Web服务,我怎么给输入到该Web服务即:查找对象。

同时,我怎么能弄清楚是否是一个JAX-WS,因为我只有WSDL文件,我想使用apache-骆驼是Web服务创建客户。

LookupRequest类看起来是这样的: -

public class LookupRequest {

        @XmlElement(name = "EntityReference")
        protected List<EntityReference> references;
        @XmlElement(name = "AttachmentReference")
        protected List<AttachmentLookupReference> attachmentReferences;
        @XmlAttribute(name = "countryCode")
        protected String countryCode;
        @XmlAttribute(name = "languageCode")
        protected String languageCode;
}

我是否需要创建lookupRequest对象,并将其发送到服务器或我可以送字符串呢?

wsdl apache-camel soap-client
2个回答
1
投票

首先,你需要用CXF wsdl2java的帮助下生成WSDL从客户端。然后您可以利用骆驼CXF组件将请求发送到要调用服务器服务,在这里,你可以看看an example


0
投票

你可以尝试发送XML请求:

首先设置两个头.setheader(“operationNamespace”,该命名空间TNS是别名).setheader(“operationName”,“查找”)

然后使用CFX组分 “CXF:{{URL}} WSDLURL = someWsdlInclasspath.wsdl&DATAFORMAT =有效载荷”

那么你就可以发送请求为XML(身体)

© www.soinside.com 2019 - 2024. All rights reserved.