Eviware Forum

soapUI => soapUI => Topic started by: Juergen on March 10, 2008, 10:54:21 am



Title: Log SOAP-Requests and Responses ?
Post by: Juergen on March 10, 2008, 10:54:21 am
Hello,

is there a simple way to log soap-requests and soap-responses with a groovy script?
Unfortunately I found no example to the topic. The goal is to store the complete Requests and Responses in a data base.

Thanks

Juergen


Title: Re: Log SOAP-Requests and Responses ?
Post by: omatzura on March 10, 2008, 11:40:04 am
Hi Juergen,

It shouldn't be that difficult,

// get the request object
def request = testRunner.testCase.testSteps["Request 1"].testRequest

// get the actual messages
def requestContent = request.requestContent
def responseContent = request.response.contentAsString'

// save them
...

(check the GroovySQL documentation..)


soapUI Pro has a DataSink TestStep which makes it a breeze to save properties like this to files, databases, etc.. Have a look at http://www.soapui.org/userguide/functional/datasinkstep.html

Hope this helps!

regards,

/Ole
eviware.com


Title: Re: Log SOAP-Requests and Responses ?
Post by: Juergen on March 10, 2008, 12:42:51 pm
Thank's Ole for your quick answer,

your solution works fine.

The option with the data sink is no solution in this case, because i'm working with multiple environments and i have no idea how the connection string of the database step can be parameterized.

Thanks a lot

Juergen


Title: Re: Log SOAP-Requests and Responses ?
Post by: omatzura on March 10, 2008, 01:15:14 pm
Hi,

you can parameterize the connection-string using standard soapUI property-expansions, ie if you store host, db, etc.. in a properties-step, you can expand these in the connection string with something like

jdbc:XXX://${#Properties#Host}/${#Properties#Database}

regards!

/Ole
eviware.com