Web 服务消费者 Anypoint Studio(CE 运行时):如何传递参数? [英] Web Service Consumer Anypoint Studio (CE runtime): How to pass params?
问题描述
我需要在 Web 服务/SOAP 调用中传递参数.
I need to pass params on Web Service/SOAP calls.
我在 Anypoint Studio 中使用 Web Service Consumer(需要在 Mule CE - Community Edition 上运行),但收到以下消息:不支持包含超过 1 个部分的操作消息"
I am using Web Service Consumer in Anypoint Studio (needs run on Mule CE - Community Edition), but I received the following message: "Operation messages with more than 1 part are not supported"
是否有一个表单可以在 Mule CE 上调用 Web 服务/SOAP 传递参数?
Is there a form to call Web Service/SOAP on Mule CE passing params?
感谢任何帮助/示例!
同意评论,我正在测试一个计算器网络服务,在SoapUI中返回结果正常,但在mule中返回0.
Accord comment, I am testing a calculator web service, in SoapUI return result OK, but in mule return 0.
我正在使用 Set Payload 组件传递参数.我使用 SoapUI 上返回的xml 请求"设置了该值.
I am passing the params with Set Payload component. I setted the value with "xml request" returned on SoapUI.
遵循 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>
问题出在哪里?谢谢!
推荐答案
我发现了它的工作原理.
I found how it works.
我们需要向 Web Service Consumer 传递它只是参数,而不是完整的 XML 封装.跟随 Set Payload 的值只是参数:
We need to pass Web Service Consumer it´s just params, does not full XML envelop. Following the value of the Set Payload just params:
<ns0:Add xmlns:ns0="http://tempuri.org/">
<ns0:intA>1</ns0:intA>
<ns0:intB>3</ns0:intB>
</ns0:Add>
这篇关于Web 服务消费者 Anypoint Studio(CE 运行时):如何传递参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!