将数据库结果作为参数传递给mule中的setpayload组件

时间:2014-04-07 13:42:17

标签: mule mule-studio mule-el

我正在使用从oracle数据库中检索值,我想将此参数传递给mule ESB 3.4中的setpayload组件。

我以下面的格式传递我的参数。

'#[{10,2,payload[0]['rate'],payload[0]['name']}]'

我收到参数类型不匹配错误。

如何传递参数,请帮我正确的语法。

提前致谢

这是我的xml代码

<jdbc-ee:oracle-data-source name="Oracle_Data_Source" user="abcd" password="123434" url="jdbc:oracle:thin:@//localhost:1522/xe" transactionIsolation="UNSPECIFIED" doc:name="Oracle Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="Oracle_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
    <jdbc-ee:query key="Select" value="select applicant_name,rate from interestcalculation where applicant_name = #[message.payload]"/> </jdbc-ee:connector>

<flow name="SetApplicantNameflow" doc:name="SetApplicantNameflow">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP" path="interest"/>
    <set-payload value="kanagaraj" doc:name="ApplicantName"/>
    <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="Select" queryTimeout="-1" connector-ref="Database" doc:name="Applicant Rate"/>
    <logger message="#[payload[0]['RATE']],#[payload[0]['APPLICANT_NAME']]" level="INFO" doc:name="Logger"/>
    <flow-ref name="interestcalcultionflow" doc:name="InterestCalculationFlow Reference"/>
    <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="update" queryTimeout="-1" connector-ref="Database" doc:name="Save interest">
        <jdbc-ee:query key="update" value="update interestcalculation set interest = #[message.payload.interest] where appid= #[message.payload.appid]"/>
    </jdbc-ee:outbound-endpoint>
    <mulexml:object-to-xml-transformer doc:name="Object to XML"/>
</flow>
<sub-flow name="interestcalcultionflow" doc:name="interestcalcultionflow">
    <set-payload value="#[{1,10,payload[0]['RATE'],payload[0]['APPLICANT_NAME']}]" doc:name="Principle,years&amp; Rates"/>
    <cxf:jaxws-client  clientClass="pack.interest.InterestclassService"  doc:name="SOAP" operation="calculateInterest" port="interestclassPort"/>
    <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/calculateInterest/services/interestclassPort" doc:name="HTTP"/>
</sub-flow>`

1 个答案:

答案 0 :(得分:0)

您可以通过执行

来使set-payload正常工作
<set-payload value="#[{1,10,(payload[0]['rate']),(payload[0]['applicant_name'])}]"/>