【发布时间】: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="<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"> <soap:Header/> <soap:Body> <tem:Add> <tem:intA>3</tem:intA> <tem:intB>2</tem:intB> </tem:Add> </soap:Body> </soap:Envelope>" 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