Forum Discussion

hanning's avatar
hanning
New Contributor
17 years ago

Removing some empty elements while leaving others empty

First off, thank you for a great product!

Now, I have a question regarding data sources and the Remove Empty Content feature.  I posted a similar question already but thought the questions were different enough to warrant separate topics.  When using an Excel spreadsheet as a data source, is there a way in SoapUI Pro (I'm currently on 2.0) to accomplish the following?

I want to be able to have "empty" cells in my Excel spreadsheet data source, some of which would cause the target elements in the request to be removed and some of which would leave empty target elements in the request.

I'm thinking that I would have to:
1. Fill out to-be-removed elements as empty cells in the spreadsheet
2. Fill out to-be-empty elements with some magic value, say "!EMPTY!"
3. Turn the Remove Empty Content feature off for the request step
4. Write a Groovy script, placed before the request step, that will remove empty elements.
5. Write a Groovy script, placed in between the request step and the above Groovy script, that will replace "!EMPTY!" with a blank string or a null value

Does this sound like something that could work as desired?  Is there an easier way, perhaps one already supported?  In the little searching I've done so far I haven't stumbled upon a solution, so pardon me if I've missed something obvious.
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    see my answer to your other question; the soapUI extension mechanism described at http://www.soapui.org/architecture/extensions.html would probably help you with this; create your own RequestFilter that removes/modifies the request as required just before it is sent..

    I'm working on a tutorial for this, so if you have a little patience I'll get you going in a week or two :-)

    regards!

    /Ole
    eviware.com
  • hanning's avatar
    hanning
    New Contributor
    Thank you for the answers, Ole.  I'll look into your suggestion while I await the tutorial.