Forum Discussion

Juergen's avatar
Juergen
Occasional Contributor
17 years ago

Log SOAP-Requests and Responses ?

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

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    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/functio ... kstep.html

    Hope this helps!

    regards,

    /Ole
    eviware.com
  • Juergen's avatar
    Juergen
    Occasional Contributor
    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
  • omatzura's avatar
    omatzura
    Super Contributor
    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