1

I can get the response xml using Groovy script. I need to get the request XML since I need to add 'assertion script' to my soap ui testing.

I am using the following code to get the response xml

def response = new XmlHolder(messageExchange.responseContentAsXml)

But I am not sure how to get the request xml of SOAPUI. Can anyone please help me in getting the request xml of SOPAUI?

user1514499
  • 762
  • 7
  • 26
  • 63

1 Answers1

4

To get the request content as a string you can use

testRunner.testCase.testSteps["Name of your teststeup"].testRequest.response.getRequestContent()

More information on the SoapUI API can be found at http://www.soapui.org/apidocs/index.html?overview-summary.html. Have a look at the Request and Response class in particular for the methods and properties they provide

Ruben
  • 56
  • 3
  • 1
    Note that if the test step has never been run, the `response` will be null, but you can use: `testStep.testRequest.getRequestContent()` instead. – DarthPablo Apr 20 '15 at 07:33
  • Note also that the request content from the testStep is pre-tokenised (if you are using `${#TestCase#property_name}` type property expansion), so in order to get the post-tokenised content, you'll have to use `messageExchange.requestContent` – DarthPablo Apr 21 '15 at 09:13