我是Mule的新手,需要你的帮助来消费它。我有一个第三方SOAP服务,它接受一个输入并提供一个输出,如下所述。如何从MULE调用它,它是一个直通代理,因此需要转换。只需要从Mule调用它。
请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://test.co.nz/controlkeysdetails">
<soapenv:Header/>
<soapenv:Body>
<con:getControlKeyDetail xmlns:con="http://test.co.nz/controlkeysdetails">
<con:keyCode>M2M_IN_PRODUCT_CODE</con:keyCode>
</con:getControlKeyDetail>
</soapenv:Body>
</soapenv:Envelope>
响应:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ControlKeyDetailResponse xmlns="http://test.co.nz/controlkeysdetails"/>
</soapenv:Body>
</soapenv:Envelope>
骡子代码:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" service="DSS_ControlKeyDetailsProxy" port="DSS_ControlKeyDetailsProxyHttpSoap11Endpoint" serviceAddress="http://esb1.test.2degreesmobile.co.nz:8280/services/DSS_ControlKeyDetailsProxy.DSS_ControlKeyDetailsProxyHttpSoap11Endpoint" wsdlLocation="http://hnzclakl194:8280/services/DSS_ControlKeyDetailsProxy?wsdl" doc:name="Web Service Consumer"/>
<flow name="soapwebserviceFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<set-payload value="{'con:keyCode':'M2M_IN_PRODUCT_CODE'}" doc:name="Set Payload"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="getControlKeyDetail" doc:name="Web Service Consumer"/>
</flow>
</mule>
非常感谢任何帮助。
感谢你的答复Anirban。我更新了代码,但收到“org.apache.cxf.interceptor.Fault:COULD_NOT_READ_XML_STREAM”错误。我不知道如何设置Payload
答案 0 :(得分:0)
1.请求 {strong> <ws:consumer/>
之前的请求可能位于设置的有效负载组件中: -
<con:getControlKeyDetail xmlns:con="http://test.co.nz/controlkeysdetails">
<con:keyCode>M2M_IN_PRODUCT_CODE</con:keyCode>
</con:getControlKeyDetail>
2。在<echo-component/>
之后移除<ws:consumer/>
,并将其替换为<mulexml:dom-to-xml-transformer/>
之类的内容: -
<flow name="soapwebserviceFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="getControlKeyDetail" doc:name="Web Service Consumer"/>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
</flow>