Forum Discussion

chuddy's avatar
14 years ago

Saving requests that are handled by my mock service

Hi there, am guessing that I am missing something quite obvious...

1. I have a mock web service setup.
2. I have created a single response for the mock service ("Response1").
3. I have double clicked on "Response1" to bring it up in its own window
4. I have clicked on the "Script" tab and entered the following code:

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent)
def requestXML

testFile = new File("C:\\soapui-4.5.1\\Test\\testFile.txt")

requestXML = holder.getXML
println requestXML
testFile << requestXML
testFile.createNewFile();

I expected to see the full request in both my console and the file, but all I get in both is:

[]

3 queries:

A. Any ideas what I have done wrong?

B. I am using the following as reference:

http://www.soapui.org/apidocs/index.html

However, none of the methods are described... can anybody recommend a better resource?

C. Is the following syntax correct?

requestXML = holder.getXML


I thought that the code should be the following, but get a java.lang.Exception: No signature of method error when I try it (which I did not expect):

requestXML = holder.getXML()


Thanks!
No RepliesBe the first to reply