Forum Discussion

Ganesh_Kalyanam's avatar
Ganesh_Kalyanam
Occasional Contributor
16 years ago

Storing the Request and Response from the "Raw" Source View

Hi,

Is there any function in groovy Script to retrieve the data from the "Raw" Tab View for the executed/submitted SOAP Request and Response.

Thanks in Advance
Ganesh

3 Replies

  • Ganesh_Kalyanam's avatar
    Ganesh_Kalyanam
    Occasional Contributor
    Hi,

    I'm able to retrieve the Raw data by using the below Groovy Script.

    Suppose i have a Test Step by Name "Test Request", then

    def testReq = testRunner.testCase.getTestStepByName("Test Request").getTestRequest().getResponse().getRawRequestData()

    This will return the Raw Data in Array of Bytes(byte[]). To convert it to proper string

    def rawData = new String(testReq)

    If any one has a better script to fetch the Raw Data, please provide it.

    Thanks,
    Ganesh
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    this looks just fine.. you can make it more "groovy" with

    def testReq = testRunner.testCase.testSteps["Test Request"].testRequest.response.rawRequestData

    Alternatively you can get it from the corresponding TestStepResult object as described at http://www.eviware.com/blogs/oleblog/?p=442, once you have the result for the "Test Request" step you can use

    def testReq = result.rawRequestData

    regards!

    /Ole
    eviware.com