4

WSO2 ESB でプロキシ サービスを開発しています。

この構成で、xml Web サービスの応答を取得します。応答は、次のようにデフォルトの名前空間を使用します。

<enrich>
<source type="body" clone="true" />
<target type="property" property="soapXmlResponseReadCahceDataService" />
</enrich>

これは xml 応答です。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<cacheServices **xmlns="http://cache.services"**>
<cacheService>
   <id>1</id>
   <xmlrequesthash>b1e97b67-1226-4b1d-9081-b2a140690efd</xmlrequesthash>
   <xmlrequestpayload>c</xmlrequestpayload>
   <xmlresponsepayload>d</xmlresponsepayload>
   <quantity>1</quantity>
   </cacheService>
</cacheServices>
</soapenv:Body> </soapenv:Envelope>

その後、要素の数量を取得する必要があります:

<property xmlns="http://cache.services" name="count" expression="//cacheServices/cacheService/quantity" />

WSO2 ESB では、プレフィックスなしで名前空間を配置することはできず、この値を取得できません。XML 応答には名前空間プレフィックスがないため、この値を取得することはできますか?

4

1 に答える 1

1

プロパティメディエーターでこのxpathを試すことができますか?

 <property name="count" expression="//*[name()='cacheServices']/*[name()='cacheService']/*[name()='quantity']" scope="default" type="STRING"/>

または、デフォルトの名前空間を使用しているため、任意の名前空間プレフィックスを追加してこれを使用できます。

 <property xmlns:ns1="http://cache.services" name="count" expression="//ns1:cacheServices/ns1:cacheService/ns1:quantity" scope="default" type="STRING"/>
于 2012-10-29T10:08:14.507 に答える