消息丰富器的使用

发布于 2024-12-28 06:19:27 字数 1396 浏览 2 评论 0原文

我有一个带有一些javabean有效负载的骡子流,我想做的是使用从https出站url返回的一些xml(xpath)来丰富一些变量。

我正在尝试的是这样的:(假设整个证书/tls问题不是问题):

<enricher>
    <https:outbound-endpoint name="clientEndpoint" address="https://someaddress" 
         connector-ref="httpConnector" exchange-pattern="request-response"/> 
        <enrich target="#[variable:paymentValidated]" source="#[xpath:INCIDENTS/INCIDENT/@state]" />
</enricher>
<logger message="#[variable:paymentValidated]" level="ERROR" />

但是,我似乎无法使用从https端点返回的xml,我不断收到XPATH违规。检查后我的 xpath 与验证器我确信我给出了正确的 xpath

但问题没有解决

我也尝试使用 bytearraytostring 响应转换器- 我正在尝试解析:

<?xml version="1.0" encoding="UTF-8" ?> 
<INCIDENTS process_ms="56">
  <INCIDENT assignee="Unassigned" closedtime="" createdtime="Fri Jan 20 15:13:10 EST 2012" creator="System" disposition="Not Set" disposition_id="-1" domain="SES" guid="5749976847410062927" id="147" incident_type="security" modifiedtime="Sat Jan 21 15:13:15 EST 2012" open_duration="2 days 18 hours 53 mins 56 secs" priority="3" referencenum="0000000147" severity="4" state="New" state_id="0" status="Open" status_id="1" team="Unassigned" tracking="No" type="SomeType" userpriority="">
    <DESCRIPTION>
    <![CDATA[ Some message" ]]> 
    </DESCRIPTION>
  </INCIDENT>
</INCIDENTS>

I have a mule flow with some javabean payload, what i'd like to do is enrich some varaiables using some xml (xpath) returned from an https outbound url.

What i"m trying is something like: (Assume the whole certificate/tls issue is not the problem):

<enricher>
    <https:outbound-endpoint name="clientEndpoint" address="https://someaddress" 
         connector-ref="httpConnector" exchange-pattern="request-response"/> 
        <enrich target="#[variable:paymentValidated]" source="#[xpath:INCIDENTS/INCIDENT/@state]" />
</enricher>
<logger message="#[variable:paymentValidated]" level="ERROR" />

However, i cant seem to be able to work with the xml returned from the https endpoint, i keep getting XPATH violations. after checking my xpath with a validator i am certain that i am giving a correct xpath.

I also tried using a bytearraytostring response tranformer - but the problem was not solved.

Anyone have any idea how to fix this and make it work??

The xml i"m attempting to parse:

<?xml version="1.0" encoding="UTF-8" ?> 
<INCIDENTS process_ms="56">
  <INCIDENT assignee="Unassigned" closedtime="" createdtime="Fri Jan 20 15:13:10 EST 2012" creator="System" disposition="Not Set" disposition_id="-1" domain="SES" guid="5749976847410062927" id="147" incident_type="security" modifiedtime="Sat Jan 21 15:13:15 EST 2012" open_duration="2 days 18 hours 53 mins 56 secs" priority="3" referencenum="0000000147" severity="4" state="New" state_id="0" status="Open" status_id="1" team="Unassigned" tracking="No" type="SomeType" userpriority="">
    <DESCRIPTION>
    <![CDATA[ Some message" ]]> 
    </DESCRIPTION>
  </INCIDENT>
</INCIDENTS>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放我走吧 2025-01-04 06:19:27

由于您没有显示确切的错误,我将尝试猜测。

我认为问题在于您从事件列表中选择状态属性,而不是仅选择一个。尝试使用:

/INCIDENTS/INCIDENT[1]/@state

Since you're not showing the exact error, I'll try to guess.

I think the issue comes from the fact you select the state attribute from a list of incidents instead of just one. Try with:

/INCIDENTS/INCIDENT[1]/@state
淡墨 2025-01-04 06:19:27

您还可以使用 Mule 3.6 中的 Mule Xpath3 功能
类似以下内容:-

#[xpath3('/INCIDENTS/INCIDENT[1]/@state')]

请在此处找到 Xpath3 的链接:- https://developer.mulesoft .com/docs/display/current/XPath

You can also use the feature of Mule Xpath3 which is from Mule 3.6
Something like follow :-

#[xpath3('/INCIDENTS/INCIDENT[1]/@state')]

Please find the linke for Xpath3 here :- https://developer.mulesoft.com/docs/display/current/XPath

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文