Forum Discussion

VishnuPrasanthS's avatar
VishnuPrasanthS
Occasional Visitor
2 years ago

XML - Parameterization - setPropertyValue - setNodeValue

I am trying to parameterize an XML in SoapUI using groovy language.

 

I am able to hit the endpoint and receive the response.

 

The issue is that, the parameters are received from the excel sheet and use to update the XML nodes. but, the values are not updated.

 

CODE:

if (reqTagName == "NumberA") {
log.info writableSheet.getCell(Col,Row).getContents() // able to read contents successfully
testRunner.testCase.setPropertyValue("NumberA", writableSheet.getCell(Col,Row).getContents());
}

if (reqTagName == "NumberB") {
log.info writableSheet.getCell(Col,Row).getContents()  // able to read contents successfully
testRunner.testCase.setPropertyValue("NumberB", writableSheet.getCell(Col,Row).getContents());
}

if (ColumnCount!=0) {

String reqTagValue = writableSheet.getCell(Col,Row).getContents()
if (reqTagValue.length()>0) {

reqholder.setNodeValue("//*:"+reqTagName, reqTagValue)
reqholder.updateProperty();
}

 

XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Add>
<tem:intA>${#TestCase#NubmerA}</tem:intA>
<tem:intB>${#TestCase#NumberB}</tem:intB>
</tem:Add>
</soapenv:Body>
</soapenv:Envelope>

 

Excelsheet:

Test_IDNumberANumberBOperationExecutionStatus
TC_00011920ADDYes

 

XML that is generated:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Add>
<tem:intA></tem:intA>
<tem:intB></tem:intB>
</tem:Add>
</soapenv:Body>
</soapenv:Envelope>

 

Please help me with this issue

No RepliesBe the first to reply