2015-11-30 12 views
1

是否可以使用富媒体丰富特定的节点值?如何丰富OM属性中的节点值?

我的目标是为了丰富这个XPath:

$ctx:OriginalPayload//Partner[identifiers/businessId = $ctx:CorrelationId]/identifiers/otherId 

我已经试过这些例子:

$ctx:OriginalPayload//Partner/identifiers/otherId 
//Partner/identifiers/otherId 
//Partner/identifiers/otherId/text() 
//Partner/identifiers/otherId/node() 

全部给了我这个错误:

ERROR - EnrichMediator Invalid Target object to be enrich. 

我用这语法:

<enrich> 
    <source xpath="//plat:CustomerAccountId"/> 
    <target xpath="//Partner/identifiers/otherId"/> 
</enrich> 

下面是我的有效载荷,我正在努力充实:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://iszkody.lsn.io/service/internal/ClaimService"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ns0:createClaimRequest> 
     <claim> 
      <InsClaimData VER="1"> 
       <PartnerList> 
        <Partner> 
        <RoleList> 
         <Role>UBEZP</Role> 
        </RoleList> 
        <BusinessPartner> 
         <partnerType>person</partnerType> 
         <personData> 
          <firstName>JANUSZ</firstName> 
          <lastName>KOWALSKI</lastName> 
          <PESEL>83248328432</PESEL> 
         </personData> 
         <identifiers> 
          <businessId>123</businessId> 
          <otherId></otherId> 
         </identifiers> 
        </BusinessPartner> 
        </Partner> 
       </PartnerList> 
      </InsClaimData> 
     </claim> 
     </ns0:createClaimRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

它看起来并不像有效载荷或XPath,但更像是调停没有实现自定义类型的问题。

+0

您可以提供应用丰富介体的XML有效载荷吗? – FiveO

+0

我想你错过了中间标签BusinessPartner。尝试一次'/ /合作伙伴/ BusinessPartner /标识符/ otherId' – FiveO

+0

什么都没有改变... – poison64

回答

2

我只是测试在WSO2 ESB 4.9.0以下,也和4.8.1两个版本,下面的代理没有工作(我enrichted与businessId的otherId):

<proxy xmlns="http://ws.apache.org/ns/synapse" name="Test_XPath" transports="http" xmlns:avintis="http://www.avintis.com"> 
    <target faultSequence="faultSequence"> 
     <inSequence> 
      <sequence key="initSequence" /> 
      <log level="full"></log> 
      <log level="custom"> 
       <property expression="$body//businessId" name="xpath" /> 
      </log> 
      <log level="custom"> 
       <property expression="$body//Partner/BusinessPartner/identifiers/businessId" name="xpath" /> 
      </log> 
      <enrich> 
       <source xpath="//businessId" /> 
       <target xpath="//otherId" /> 
      </enrich> 
      <log level="full" /> 
     </inSequence> 
    </target> 
</proxy> 

当你评论说,您现在使用*[local-name()='BusinessPartner']语法,这指出命名空间是一个问题。尝试使用BusinessParter元素的正确名称空间。

+0

你是指正确的命名空间? BusinessPartner元素是否从createClaimRequest继承了ns0命名空间? – poison64

+0

一个XML元素可能有一个类似于''的名称空间,其名称空间前缀为'ns0',它表示命名空间'http:// iszkody.lsn.io/service/internal/ClaimService'。因此,使用* [local-name()= Something]时唯一要做的就是避免命名空间检查。当您使用正确的namespacePrefix:elementName时,它也可能工作。不要忘记在代理根元素中添加名称空间。 – FiveO