Forum Discussion

zitryss's avatar
zitryss
Occasional Contributor
10 years ago

Pretty print of response messages

Hello everyone,

 

recently I noticed, that when the asynchronous responses are received and then shown in the MockResponse step, they are not formatted by default.   The funny thing is that the option "pretty print response messages" in on. Is there any another way of formatting a XML? Probably with the help of Groovy script?

 

Thank you in advance for any help you can provide!

 

Kind regards,

Eugene

  • I have not happened to use soapUI for asynchronous requests. So do not have idea.

     

    However, noticed same behaviour while using soap over jms and this was a synchronous call. Tried to manupilate the response before showing the result to the user without using additional test step and could not be successful yet. But if you like it to do with an additional groovy step, am sure you should be able to do it, check this.

  • nmrao's avatar
    nmrao
    Champion Level 3

    I have not happened to use soapUI for asynchronous requests. So do not have idea.

     

    However, noticed same behaviour while using soap over jms and this was a synchronous call. Tried to manupilate the response before showing the result to the user without using additional test step and could not be successful yet. But if you like it to do with an additional groovy step, am sure you should be able to do it, check this.

    • zitryss's avatar
      zitryss
      Occasional Contributor

      Hello Rao,

       

      thank you gratefully for the link! Now I am able to beautify an incoming XML and there is only one problem left for me. The question is how to write the prettyfied XML back in the Request of Mock Response test step. Here is what I already have written:

       

       

      def non_formatted_xml = context.expand('${Mock Response#Request}')
      def formatted_xml = groovy.xml.XmlUtil.serialize(non_formatted_xml)

       

       

      And again thank you in advance!

       

      Best wishes,

      Eugene

      • nmrao's avatar
        nmrao
        Champion Level 3

        Glad to know that.

         

        And recommend forum members not to cross post. So, I would suggest you to post in a new topic with the other query you got.