2016-11-13 6 views
0

Я новичок в Mule и нуждаюсь в вашей помощи, чтобы потреблять его. У меня есть сторонняя SOAP-служба, которая берет один вход и предоставляет один вывод, как указано ниже. Как я могу назвать это из MULE, это прокси-сервер, поэтому требуется преобразование. просто нужно позвонить ему из Мула.Как использовать SOAP Webservice в Mule ESB

Запрос:

<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> 

Mule Код:

<?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

1.Put просьбе перед тем<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>