質問

次のXPath

を使用したいです。

/ users / user / userid

ESBがXMLの周りにSOAPエンベロープとボディを追加するため、これは機能しません。使用する正しいXPathは、SOAP EnvelopeとBodyを削除できますか?

XMLは次のとおりです。

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <Users xmlns="http://ws.wso2.org/dataservice">
         <User>
            <UserID>a</UserID>
            <Username>a</Username>
            <Email>a</Email>
            <Password>a</Password>
         </User>
         <User>
            <UserID>a</UserID>
            <Username>a</Username>
            <Email>a</Email>
            <Password>a</Password>
         </User>
         <User>
            <UserID>a</UserID>
            <Username>a</Username>
            <Email>a</Email>
            <Password>a</Password>
         </User>
      </Users>
   </soapenv:Body>
</soapenv:Envelope>
.

編集:

これは私が私の反復メディエーターの外でそれを録音しようとするとき

//*[local-name() = 'Users']/*[local-name() = 'User']/*[local-name() = 'UserID']
.

しかし私が繰り返しメディエーターの中に記録しようとしたとき、それは何も返しませんか?

役に立ちましたか?

解決

次の

を使って作業しました
<property xmlns:int="http://ws.wso2.org/dataservice" name="uri.var.ID" expression="$body/int:User/int:UserID/text()" scope="default" type="STRING"/>
.

他のヒント

あなたの要素にアクセスするためにあなたは封筒と体を通過するべきです。 これはスイッチメディエータの例です:

<switch xmlns:ns="http://org.apache.synapse/xsd" 
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:int="http://ws.wso2.org/dataservice" 
        source="boolean(/soap:Envelope/soap:Body/int:Users/int:User/int:UserID/text() = 'string_to_compare'">
  <case regex="true">
     ....
  </case>
  <default/>
</switch>
.

Upd. XPath式

を修正しました

これを試してみてください:

<property name="yourParamName" expression="$body/Users/User/UserID" scope="default" type="STRING"/>
.

事前定義済みのシナプスXPath変数

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top