0

次のミュール フローでは、xpath を使用して、メッセージを送信する必要があるキューを決定しています。ただし、XML に tc="121" が含まれていても、xpath 式は false を返します。私が間違っていることを教えてもらえますか?

以下は、XPath によって評価された Mule フローと XML です。

ラバの流れ:

<flow name="ProcessXMLRequest">
    <jms:inbound-endpoint exchange-pattern="one-way" queue="mq.xml.request" />
    <logger message="XML payload is #[payload]" level="INFO" />
    <choice>
        <when expression="/TXLife/TXLifeRequest/TransType/@tc='121'"
            evaluator="xpath">
            <jms:outbound-endpoint queue="mq.121.request.apps" />
        </when>
        <when
            expression="/TXLife/TXLifeRequest/TransType/@tc='1122'"
            evaluator="xpath">
            <jms:outbound-endpoint queue="mq.1122.request.apps" />
        </when>
        <otherwise>
            <jms:outbound-endpoint queue="mq.error"/>
        </otherwise>
    </choice>
</flow>

XML:

<TXLife xmlns:ns2="http://abc.com/services/mvi" xmlns="http://ACORD.org/Standards/Life/2">
    <TXLifeRequest PrimaryObjectID="Holding_1">
        <TransType tc="121">121</TransType>
        <TransMode tc="2">2</TransMode>
    </TXLifeRequest>
</TXLife>
4

1 に答える 1

3

これは名前空間の問題です。http://ACORD.org/Standards/Life/2名前空間を構成し、XPath式で使用する必要があります。

Muleでは、これは名前空間マネージャーを使用して次のように実現されます。

<mulexml:namespace-manager>
  <mulexml:namespace prefix="life2" uri="http://ACORD.org/Standards/Life/2"/>
</mulexml:namespace-manager>
于 2012-07-09T20:15:30.120 に答える