Hi Suraj,
I'm not sure if this is 100% correct, this is just my understanding:
Both options are calling constructors in this class:
https://www.soapui.org/apidocs/com/eviware/soapui/support/XmlHolder.html
but the 1st option is invoking this one - XmlHolder(String xml)
the 2nd is calling this - XmlHolder(PropertyExpansionContext context, String propertyRef)
The second option is creating object of this class:
https://www.soapui.org/apidocs/com/eviware/soapui/support/GroovyUtils.html
and then calling this method:
getXmlHolder(String xmlPropertyOrString)
Therefore this String:
"Request 1#Response"
can be parsed into 2 params - Request 1 and Response so it could be used in the constructor with 2 params.
The advantage is that you can specify TestStep (only in your current TestCase) and its property and the XmlHolder will create the holder from it.
An example to understand it:
it much more simplier to write this - def holder = groovyUtils.getXmlHolder( "Request 1#Response" )
instread of this - def holder = new XmlHolder(testRunner.testCase.testSteps["Request 1"].getPropertyValue("Response"))
You can still use groovyUtils's holder as follows:
groovyUtils.getXmlHolder(messageExchange.responseContentAsXml)
To sum up, the groovyUtils's holder is giving you more options to create the actual xml holder.
Does it make sense to you?
Regards,
Marek