Few months back i was struggling to capture the Raw Request data from the test step and to store it (together with response) into a file. Now you might be wondering why to struggle so much if the test step request data can be simply accessed using :


Well above script snippets will fetch the request data from the mentioned/selected test step. However, if your test is parametrized then this (request data) will also appear as in same way as it appears in request window [i.e., not with actual parameter values].
Since, it is a parametrized request the original values of parameters can be found in the Raw tab of the teststep request window. This concept can be compared to “PreProcessors in C” or “Inline function of C++” where the actual values of parameter will be replaced before compiling the program. Here also, before sending out the request data (or say encapsulating it in SOAP envelope) to the server the parameter values will be replaced with each parameter calls in the test request.

If raw request data not used, then while performing the comparison of the different request & response data after final run, it would be difficult for us to trace what parameter value was passed during teststep run.
To overcome such issues, soapUI team also exposed couple of methods which can be used to extract the RawRequest / RawResponse data and so on. Shared below is one of the ways to get the raw request data :



  1. Aaron says:

    it’s great!!! thanks for your sharing!!
    I also have a question: maybe I want to get message from topic, but i don’t know how to configure the groovy script. though I copy the script from soapui online document about visiting queue, for topic,I’ve no idea. would you please advise me regarding this issue?

    PS: I have configured the Tibco EMS and put some message on the queue and topic.

    thanks in advance,

    • Hi Aaron,
      I never had a chance to work on anything related to Hermes or/and TIBCO. So not sure what/how exactly i can help here. However just thinking to start with JMS connection using soapUI, if i will find any free working JMS examples.

      /Pradeep Bishnoi

  2. Aaron says:

    import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSConnectionHolder
    import com.eviware.soapui.impl.wsdl.submit.transports.jms.util.HermesUtils
    import com.eviware.soapui.impl.wsdl.submit.transports.jms.JMSEndpoint
    import hermes.Hermes
    import javax.jms.*

    /*get jmsEndpoint*/
    def jmsEndpoint = new JMSEndpoint(“jms://TibcoEMS::-::queue_TESTING_DUMMY_OUTPUT_MESSAGE”);

    /*static hermes.Hermes //Projecct:ACARASDownlinkMessageTestProject sessionName:TibcoEMS*/
    def hermes = HermesUtils.getHermes( context.testCase.testSuite.project, jmsEndpoint.sessionName)

    /*parameters: jmsEndpoint,hermes.Hermes,isTopicDomain,clientID,username,password*/
    def jmsConnectionHolder = new JMSConnectionHolder( jmsEndpoint, hermes, false, null ,null ,null);

    Session queueSession = jmsConnectionHolder.getSession();

    /*getQueue: return queue by name*/
    Queue queueBrowse = jmsConnectionHolder.getQueue( jmsConnectionHolder.getJmsEndpoint().getReceive() );

    QueueBrowser qb = queueSession.createBrowser(queueBrowse);
    Enumeration en= qb.getEnumeration();
    TextMessage tm = (TextMessage)en.nextElement();
    log.info tm.getText()
    jmsConnectionHolder.closeAll() /* don’t forget to close session and connection*/

  3. Karthik says:

    Hi Aaron,

    why you need groovy for that ?
    There is one option JMS Header in TestStep Level
    Message Selector : JMSCorrelationID = ‘Your Message correlation ID’
    Is that helpful?

    – Karthik

  4. Aaron says:

    hi Karthik,
    I put some message on queue, so I’d like to browse them through script.
    yes, you are right, in JMS header, I fill in subscription name,cliendID and MessageSelector, these conditions can help me filter the message so that I can get the designated message what I need.
    and now, I need to use the same method to fetch message, this time I put the message on topic. and you know, the topic feature has a little different with queue. but i dont’ know how to tailor it so that the script adapts to topic. do u catch my drift?

    thanks your attention,

  5. Hi Aaron, Hi Karthik,

    You people seems to have working knowledge about the JMS handling using soapUI. I was wondering, if you people would help me learn the same by sharing some blog post on the my Blog? Do let me know, if you want to. In that case, we can try to find the working/free JMS solution over internet and share with other reader. Thanks!
    /Pradeep Bishnoi

  6. Karthik says:

    Hi Aaron/Pradeep,

    I got you Aaron let me check the same and let u know…

    @ Pradeep,

    Me too not expert in JMS… Just started…
    If you have any queries let me know..,
    i’ll try to solve it..

    – Karthik

  7. Prachi says:

    Hi Pradeep ,

    I am working on mock service request and response xml as a tester . I have created the request and response xml for our service . I am unable to write grovvy script for a particular request to pick the correct response ….can you please help me in this .. any pointer for the same would be helpful ..

    PS : I have no idea about groovy script


  8. Raghav says:

    Thanks for the article.
    What if we need to get the request value of a parametrized request in a groovy script.

    This does not work inside groovy.

  9. Ajay says:

    Hello Prachi,
    I have started learning Soap UI and wanted to know do you have multiple mock responses for the same request ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s