0
我想從下面的響應讀取值讀取十進制值:Groovy:在如何從XML響應
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ConversionRateResponse xmlns="http://www.webserviceX.NET/">
<ConversionRateResult>59.565</ConversionRateResult>
</ConversionRateResponse>
</soap:Body>
</soap:Envelope>
我曾嘗試下面的代碼來獲取值59.565,但我正在逐漸NULL
def Xml = new XmlHolder(response)
def String rate = Xml.getNodeValue('//ConversionRateResponse/ConversionRateResult')
log.info(rate)
幫助將不勝感激!
完全無關的問題,但你並不需要做'DEF STRING rate',只是'字符串rate'將do' –