【发布时间】:2014-07-22 10:25:15
【问题描述】:
我在 MULE 中有一个接收 SOAP 消息的流。我正在尝试在此肥皂消息中提取节点的名称。
我的肥皂信息如下所示:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://abc/dto/2013/08"
xmlns:ns1="http://abc/message/dto/2013/08"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<ns:RetrieveOrgNumber>
<ns:request>
<ns1:sessionId>SessionId</ns1:sessionId>
<ns1:timeStamp>2001-12-31T12:00:00</ns1:timeStamp>
<ns1:userIdentifier>UserIdentifier</ns1:userIdentifier>
<ns1:language>EN</ns1:language>
<ns1:source>SoapUI</ns1:source>
<!-- 1 or more repetitions: -->
<ns:orgNumber>AE7WJ046</ns:orgNumber>
</ns:request>
</ns:RetrieveOrgNumber>
</soapenv:Body>
</soapenv:Envelope>
我希望能够在操作中检索节点 RetrieveOrgNumber 的名称。我想将其设置为变量。
我已经尝试过#[xpath(fn:local-name('soapenv:Envelope/soapenv:Body/*[1]'))],但我得到了这个错误:
执行表达式 xpath(fn:local-name('soapenv:Envelope/soapenv:Body/*[1]')) 失败。 (org.mule.api.expression.ExpressionRuntimeException)。消息负载的类型:字符串
我忘了补充,我确实在消息流 xml 中添加了命名空间:
<mulexml:namespace-manager>
<mulexml:namespace prefix="soapenv" uri="http://schemas.xmlsoap.org/soap/envelope/" />
<mulexml:namespace prefix="ns" uri="http://sanlam.co.za/group/party/service/clientmanagement/dto/2013/08" />
<mulexml:namespace prefix="ns1" uri="http://sanlam.co.za/group/common/message/dto/2013/08" />
<mulexml:namespace prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance" />
</mulexml:namespace-manager>
感谢马克的回复。
我尝试过编辑,但它不起作用。我不能在这里张贴我的流程图的图片。我需要至少 10 的声望。
但是考虑到您的建议,我尝试了 Object to XML(StringTobyteArray 不起作用)现在对于我的 xpath 表达式,我有:
#[xpath(local-name('soapenv:Envelope/soapenv:Body/*[1]'))]
我得到的错误是:
Caused by: [Error: unresolvable property or identifier: local]
[Near : {... xpath(local-name('soapenv:Envelope/s ....}]
^
[Line: 1, Column: 7]
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:687)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:472)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:374)
当我尝试fn:local-name 时,fn 出现命名空间错误。
【问题讨论】:
标签: web-services soap xpath mule-studio