在点击webserviceconsumer之前逐个迭代xml数组请求

时间:2016-03-15 06:51:34

标签: xml mule mule-studio mule-component mule-el

完整的请求是:

 <?xml version='1.0' encoding='windows-1252'?>
<balanceInquiry>
    <request>
        <amount>
            <amount>1</amount>
            <currency>USD</currency>
        </amount>
    </request>
    <request>
        <amount>
            <amount>2</amount>
            <currency>USD</currency>
        </amount>
     </request>
     <request>
        <amount>
            <amount>3</amount>
            <currency>USD</currency>
        </amount>
      </request>
</balanceInquiry>

在点击webconsumer之前,它应该是:

<balanceInquiry>
    <request>
        <amount>
            <amount>1</amount>
            <currency></currency>
        </amount>
    </request>
</balanceInquiry>

然后将响应置于1,然后再转为2,依此类推。

我正在为每个组件使用a,如

<foreach collection="#[payload.balanceInquiry]" doc:name="For Each">
    <ws:consumer config-ref="Web_Service_Consumer" operation="balanceInquiry" doc:name="Web Service Consumer"/>
</foreach>

但它不起作用。是否有任何其他组件可用于执行任务或我做错了。请建议。

1 个答案:

答案 0 :(得分:0)

在拨打网络服务电话之前,使用splitter拆分xml然后dom to xml transformer

<splitter expression="#[xpath3('//balanceInquiry/request',payload,'NODESET')]"/>        
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>