【问题标题】:How to consume Webservice in Mule using wsdl-cxf component如何使用 wsdl-cxf 组件在 Mule 中使用 Webservice
【发布时间】:2014-08-20 02:17:42
【问题描述】:

您好,我正在探索 wsdl-cxf 以使用 Web 服务...我有以下 Mule 流程:-

<stdio:connector name="stdioConnector" promptMessage="Enter Value :" doc:name="STDIO"/>

<flow name="ServiceFlow" doc:name="ServiceFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP"/>
<cxf:jaxws-service  serviceClass="com.test.services.schema.maindata.v1.MainData"  doc:name="SOAP"/>
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl"/>
</flow>

<flow name="inputService" doc:name="inputService" >
<stdio:inbound-endpoint system="IN" doc:name="STDIO"/>
<logger message="Payyyload : #[message.payload]" level="INFO" doc:name="Logger"/>
<outbound-endpoint address="wsdl-cxf:http://localhost:8082/mainData?WSDL&amp;method=retrieveDataOperation" doc:name="Generic"/>
<stdio:outbound-endpoint system="OUT" doc:name="STDIO"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
</flow> 

现在,第一个流 ServiceFlow 是公开的 Web 服务,当 SOAPUI 提供以下输入时,它可以正常工作:-

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://services.test.com/schema/MainData/V1">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:retrieveDataRequest>
         <v1:Id>33</v1:Id>
      </v1:retrieveDataRequest>
   </soapenv:Body>
</soapenv:Envelope>

它从数据库中获取数据并显示结果... 第二个流程 inputService 尝试使用 wsdl-cxf 来使用服务......这里我使用 stdio:inbound 来获取输入......现在当我将 Data 33 作为输入传递时......它无法从 DB 中获取值......现在我的 Web 服务实现类具有以下方法:-

public DataResponse retrieveDataOperation(
            RetrieveRequest retrieveDataRequest)
{
//All the Logic here 
}

其中 RetrieveRequest retrieveDataRequest 是作为输入的 Object 类型。那么我如何在这里使用 wsdl-cxf 传递值,这可能是一个字符串请求...我的意思是如何使用wsdl-cxf 使用 Web 服务并传递一个将 Object 作为参数的值...请帮助..

【问题讨论】:

    标签: mule mule-studio mule-component


    【解决方案1】:

    来自documentation

    CXF WSDL 提供程序的一个限制是它不允许您使用非 Java 原语(不是 String、int、double 等的对象)。

    您的网络服务接收到一个retrieveDataRequest 对象,而不是简单的类型,因此不能在您的用例中使用提供程序。

    【讨论】:

    • 谢谢大卫..明白了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-23
    • 2014-12-25
    • 2017-05-30
    • 1970-01-01
    相关资源
    最近更新 更多