消息丰富器的使用
我有一个带有一些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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您没有显示确切的错误,我将尝试猜测。
我认为问题在于您从事件列表中选择状态属性,而不是仅选择一个。尝试使用:
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:
您还可以使用 Mule 3.6 中的 Mule Xpath3 功能
类似以下内容:-
请在此处找到 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 :-
Please find the linke for Xpath3 here :- https://developer.mulesoft.com/docs/display/current/XPath