2014-09-02 66 views
0

我正面臨一個問題。從騾子讀取單行並轉換爲騾子中的SOAP請求

要求是我有一個csv文件,並應該轉換爲soap請求(soap消費者組件)。問題是所有的csv行都是一次性轉換的。在我的情況下,soap請求無法處理一個請求中的所有行。它應該是多個呼叫。

我做了什麼,要完成這一

<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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" version="EE-3.5.0" 
    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/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd 
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd 
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd 
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd 
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd"> 
    <ws:consumer-config name="Web_Service_Consumer1" wsdlLocation="CPAdministration_updated.wsdl" service="AdminService" port="AdminEndpoint" serviceAddress="http://localhost/FM/service/Hrportal?wsdlformule" doc:name="Web Service Consumer"/> 
    <data-mapper:config name="CSV_To_Xml_UpdateUserRequest_" transformationGraphPath="csv_to_xml_updateuserrequest__2.grf" doc:name="CSV_To_Xml_UpdateUserRequest_"/> 
    <flow name="soapFlow1" doc:name="soapFlow1"> 
     <file:inbound-endpoint path="E:/temp/mule" responseTimeout="10000" doc:name="File"/> 
     <data-mapper:transform config-ref="CSV_To_Xml_UpdateUserRequest_" doc:name="CSV To Xml&lt;UpdateUserRequest&gt;" /> 
     <logger message="Converted xml is here #[payload]" level="INFO" doc:name="Logger"/> 
     <ws:consumer config-ref="Web_Service_Consumer1" operation="UpdateUser" doc:name="Web Service Consumer"/> 
    </flow> 
</mule> 

回答

0

一種方法是使用分離器和聚合器。你的流可能看起來像這樣:

<flow name="soapFlow1" doc:name="soapFlow1"> 
    <file:inbound-endpoint path="E:/temp/mule" responseTimeout="10000" doc:name="File"/> 
    <data-mapper:transform config-ref="CSV_To_Xml_UpdateUserRequest_" doc:name="CSV To Xml&lt;UpdateUserRequest&gt;" /> 
    <logger message="Converted xml is here #[payload]" level="INFO" doc:name="Logger"/> 
    <splitter expression="#[xpath('//item')]" doc:name="Splitter" enableCorrelation="ALLWAYS"/> 
    <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/> 
    <ws:consumer config-ref="Web_Service_Consumer1" operation="UpdateUser" doc:name="Web Service Consumer"/> 
    <message-chunk-aggregator failOnTimeout="true" doc:name="Message Chunk Aggregator"/> 
</flow> 

xpath表達式顯然必須改變,以適應你的情況。