2015-11-30 13 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