Forum Discussion

5 Replies

  • dcbasso's avatar
    dcbasso
    Occasional Contributor
    This codes does not work for me:


    messageExchange.getRequestContentAsXml.toString()
    messageExchange.getResponseContentAsXml.toString()
  • dcbasso's avatar
    dcbasso
    Occasional Contributor
    Please, If possible someone answer me, it's a very important data That I need to handle on this Load Test.


    Thanks all!
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    try this: messageExchange.getRequestContentAsXml().toString()
    but you must perform this command in TestRequest as Script Assertation
  • Hi,

    Script code line
    messageExchange.getRequestContentAsXml().toString()
    will not work until unless you use these script lines where the messageExchange variable is exposed. So the simplest way i can suggest you to do property transfer would be a 2 step process.
    - Get the raw response content using above code lines in a script assertion and store it in a Test Case level user created property variable.
    - Write a Xpath expression on for the content (rawResponse) in the user created property variable. And transfer the so obtained value to another variable or request.

    I hope this will help or alteast give you a pointer to go about.
    Best Regards,
    /Pradeep Bishnoi
    http://learnsoapui.wordpress.com
  • martinem's avatar
    martinem
    New Contributor
    I'm trying to figure out how to log raw response in a mock AfterRequest. I don't want to have any such code for particular operations, having code in mock is better maintainable and efficient. So I have no chance for test step or assertion.

    How do i access messageExchange?

    This code doesn't work! Grabs just one response header and causes random errors during execution.
    mockResult.getMockResponse().getResponseHeaders().toString()
    The .toXml() call will work but displays only limited headers. So this is probably a bug.

    The same command works perfect for requests:
    mockResult.getMockRequest().getRequestHeaders().toString()
    it will write down all headers in a perfect text format.