Forum Discussion

Lenina's avatar
Lenina
Occasional Contributor
15 years ago

Not able to access getContentAsXml() in my code

Hi,

I am working on validating response with an xsd in soapui using groovy script.
This is my code:
*********************************************
import org.apache.xmlbeans.XmlBeans
import org.apache.xmlbeans.XmlObject
import org.apache.xmlbeans.SchemaTypeLoader

def xsd = XmlObject.Factory.parse( new File('d:\\application.xsd').text )

def sts = XmlBeans.compileXsd( ( XmlObject[] )[ xsd ], XmlBeans.getBuiltinTypeSystem(), null );
def stl = XmlBeans.typeLoaderUnion( ( SchemaTypeLoader[] )[ sts, XmlBeans.getBuiltinTypeSystem() ] )

def xml = stl.parse( (testRunner.testCase.getTestStepByName( "getCreditMemo - Request 1" ).getProperty( "response" ).getContentAsXml()), null, null )
//def xml = stl.parse( messageExchange.responseContentAsXml, null, null )

assert xml.validate()

***************************************************
This is the exception I am getting:
---------------------------------------------------------------------------
TestCase failed [groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep$3.getContentAsXml() is applicable for argument types: () values: []:groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep$3.getContentAsXml() is applicable for argument types: () values: []], time taken = 0
---------------------------------------------------

I have checked soapui source for the method getContentAsXml(), but every where it is using without arguments only.
so i am not able to understand this exception, i tried maximum, but no luck.

Please Please if anyone of has any idea on this, please share with me.

Thanks,
Lenina

2 Replies

  • Lenina's avatar
    Lenina
    Occasional Contributor
    Hi,

    Tried that also, but getting this error in this case.

    TestCase failed [groovy.lang.MissingPropertyException: No such property: messageExchange for class: Script2:groovy.lang.MissingPropertyException: No such property: messageExchange for class: Script2], time taken = 0

    Do I need to import anything for this property?

    Thanks,
    Lenina