【问题标题】:Web Service Consumer Anypoint Studio (CE runtime): How to pass params?Web Service Consumer Anypoint Studio(CE 运行时):如何传递参数?
【发布时间】:2023-04-02 09:05:02
【问题描述】:

我需要传递 Web 服务/SOAP 调用的参数。

我在 Anypoint Studio 中使用 Web Service Consumer(需要在 Mule CE - Community Edition 上运行),但我收到以下消息:“不支持超过 1 部分的操作消息”

是否有表单可以在 Mule CE 上调用 Web Service/SOAP 并传递参数?

感谢任何帮助/示例!

编辑:

根据评论,我正在测试一个计算器网络服务,在 SoapUI 中返回结果 OK,但在 mule 中返回 0。

我正在使用 Set Payload 组件传递参数。我使用 SoapUI 上返回的“xml 请求”设置了该值。

遵循 XML 代码。

<ws:consumer-config name="Web_Service_Consumer1" wsdlLocation="http://www.dneonline.com/calculator.asmx?WSDL" service="Calculator" port="CalculatorSoap12" serviceAddress="http://www.dneonline.com/calculator.asmx" doc:name="Web Service Consumer"/>
<flow name="calculadora-soap-publicoFlow">
    <poll doc:name="Poll">
        <set-payload value="&lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:tem=&quot;http://tempuri.org/&quot;&gt; &lt;soap:Header/&gt; &lt;soap:Body&gt; &lt;tem:Add&gt; &lt;tem:intA&gt;3&lt;/tem:intA&gt; &lt;tem:intB&gt;2&lt;/tem:intB&gt; &lt;/tem:Add&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt;" doc:name="Set Payload"/>
    </poll>
    <ws:consumer config-ref="Web_Service_Consumer1" operation="Add" doc:name="Web Service Consumer"/>
    <json:xml-to-json-transformer doc:name="XML to JSON"/>
    <logger level="INFO" doc:name="Logger" message="#[message.payload]"/>
</flow>

问题可能出在哪里?谢谢!

【问题讨论】:

  • 这里有一个使用 DataSense e DataWeave 的示例:docs.mulesoft.com/mule-user-guide/v/3.7/…。但是这个组件只适用于 EE 运行时!
  • 我找到了解决方案!我们只需要将参数传递给 Web 服务使用者,而不是完全封装 XML。在答案下方。

标签: web-services soap mule anypoint-studio


【解决方案1】:

我发现了它的工作原理。

我们需要传递 Web Service Consumer,它只是参数,而不是完整的 XML 封装。遵循 Set Payload 的值只是参数:

  <ns0:Add xmlns:ns0="http://tempuri.org/">
     <ns0:intA>1</ns0:intA>
     <ns0:intB>3</ns0:intB>
  </ns0:Add>

【讨论】:

    猜你喜欢
    • 2015-01-24
    • 2016-07-05
    • 1970-01-01
    • 2019-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-09
    相关资源
    最近更新 更多