2
votes

I am using SOAPUI for web service testing. I would like to do xml parsing via groovy script Test Step. For one test case, I have to insert xml tag [like <Email>[email protected]</Email>] in SOAP Request.

I can set value to xml tag using holder.setNodeValue(Xpath, Value), Using the same function I try to insert xml tag in SOAP request like holder.setNodeValue(Xpath, "<Email>[email protected]</Email>"). But in SOAP request xml tag set as

"&ltEmail>[email protected]&lt/Email>"  

Because of this problem SOAP request not recognize that xml tag, Hence the value not get reflect /update in response.

Please correct me If I am using this function wrongly. Awaiting response from anyone..

1

1 Answers

2
votes

Well that is happening because you are calling setNodeValue method. This method will set the value of the node (which can be of the XML node format).

Ideally, what you should have done is if node already exists () then just grab that node using holder and set the value. Or

xpath = "//level1/level2/email"
holder.setNodeValue(xpath, "[email protected]")

Or the simplest, add a empty property value in between the nodes.

<Name>Test</Name>
 ${Property#TestValue}
<Phone>123123</Phone>

Now say if you want to add email between name & phone, assign some value to that property variable. And if not, then leave it empty.