Forum Discussion

mohbubur_rahman's avatar
mohbubur_rahman
Contributor
16 years ago

Capturing actual Soap Request sent

Hi,

Can you help me with the syntax required to capture the actual soap request sent. If I use the following code where I have used PropertyExpansion, the request does not contain the actual values sent but the PropertyExpansion (${DataSource#ID})

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

// get the actual messages
def SOAPrequestContent = request.requestContent

Thanks,

Moks

6 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Moks,

    you need to get the actual content from the corrseponding TestStepResult object which is available through testRunner.results;

    //get last result which should be a WsdlTestRequestStepResult
    def result = testRunner.results( testRunner.results.size()-1 )

    // get the sent content
    def content = result.requestContent


    ok like this?

    regards,

    /Ole
    eviware.com
  • Is this capturing the last request sent, it does not refer to any test request step?

    How would this work if you running multiple tests at the same time, could it potentially capture any of the requests and not specificly the one you want?
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    the results array contains a TestStepResult for each testStep that has been executed during the run of the TestCase, my example expects the last step before the groovy script to have been a TestRequestStep, but you can navigate this array and find any result for any of the executed TestSteps..

    This is on a TestCase Execution basis, so the results will only contain results from the current run, not any other runs.

    regards,

    /Ole
    eviware.com
  • Hi Ole,

    I have tried that but it fails with the following error;

    groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.results() is applicable for argument types: (java.lang.Integer) values: {3} No signature of method: com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.results() is applicable for argument types: (java.lang.Integer) values: {3}

    Regards,

    Moks
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    Looks like you have a syntax error, can you show your exact script please?

    regards,

    /Ole
    eviware.com
  • Hi Ole,

    I have emailed you the GroovyScript. Please let me know what is causing the syntax error.

    Moks