dd
10 years agoVisitor
Extracting particular information from response
I am trying to fetch particular ID from soap response and I have pass that value to SQL query in the DataSource. Following is the soap response I am getting and I need to extract the text 'CDX14387' ...
- 10 years ago
You may use the following code in the script assertion for the step.
import com.eviware.soapui.support.XmlHolder
def xml = new XmlHolder(context.response) def responseValue = xml.getNodeValue("//*:CDES-PUT-Response/*:response-message") def expectedPartialString = 'Job received successfully' def pattern = '[A-Z]+[0-9]+' if (responseValue.contains(expectedPartialString)) { def group = (responseValue =~ /${pattern}/)
assert 1 == group.size(), "Received more than one CDE Job Id" context.testCase.setPropertyValue('JOB_ID',group[0]) } else { log.warning "Unexpected value in the response" }You should be able to use ${#TestCase#JOB_ID} in the next step i.e., in your jdbc request where that is needed