can't extract response value

i need help to how extract the result value

// Response body part

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=XML Schema>

soap:Body

 <InvokeResult>{

   "ResultStatus": 1,

   "Message": "SUCCESS",

   "ServiceName": "GetToken",

   "ResultType": 0,

   "Result": "1gBMIDaUpbN5TjL5igvG9+YJFbbHSKyNMYP"

   }

 </InvokeResult>

</soap:Body>

</soap:Envelope>

///// Verification part

// Get the response text as XML

def responseText = response.getResponseText()

// Parse the response as XML

def xml = new XmlSlurper().parseText(responseText)

// Extract the “Result” value

def ResultValue = xml.Body.InvokeResponse.InvokeResult.Result.text()

// Set the “Result” value as a global variable to use in subsequent steps

GlobalVariable.Result = ResultValue

// Verification result part , you will notice that value not extracted

  • 15: Result = ResultValue



3 Likes

@robotframeworkemail

You should get text from InvokeResult then use JsonSlurper to parse the text