cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Empty Content

joakimrosendahl
New Contributor

Remove Empty Content

Hi,

I almost found the perfect solution to a problem I am facing, but I don't know if you regard this as a bug or as a new feature. It seems like the feature "Remove Empty Conent" only processes the request once, but I was hoping it to do multiple passes. Removing all empty tags can result with an empty tag =). Example: Removing empty content in this pseudo-xml:

<tag1>
<prop1/>
<prop2></prop2>
</tag1>

The result from this is an tag with empty content:

<tag1/>


Regards,
Joakim.
8 REPLIES 8
Unhandled
Contributor

Re: Remove Empty Content

Where do you see the feature "Remove Empty Content"?

What is the behavior you are expecting?
Koopman_Interna
Contributor

Re: Remove Empty Content

This is a property of the Soap request (see properties grid for a soap request on the left bottom).

I have exactly the same problem. I need an array that does not have any real content in it, to be an actual empty array, not an array with empty elements if all attributes of the elements are empty.

Because this might hurt performance, it could be an extra setting "Remove Empty Content recursively", so that empty content is removed until no empty tags exist in the raw request only when this setting is true.
LarsHummelmose
Not applicable

Re: Remove Empty Content

Joakim - Your old request from 28 feb 11 (See below) ... did you ever found a proper solution ... struggeling with EXACT same issue .... All Inner tags are cleared (Simply NO text) sas wanted - but the outer tag is left and with in the tag is a number of CR/LF charecters left - subsequently the service I call throws an error because IF the tag start/tag end is send the Schema checks for the content with in the Grup tag start/tag end .... frustrating ... 😉

Regrards Lars


Remove Empty Content
by joakimrosendahl » 28 Feb 2011 13:20

Hi,

I almost found the perfect solution to a problem I am facing, but I don't know if you regard this as a bug or as a new feature. It seems like the feature "Remove Empty Conent" only processes the request once, but I was hoping it to do multiple passes. Removing all empty tags can result with an empty tag =). Example: Removing empty content in this pseudo-xml:

<tag1>
<prop1/>
<prop2></prop2>
</tag1>

The result from this is an tag with empty content:

<tag1/>


Regards,
Joakim.

Re: Remove Empty Content

Hi,

This is in our backlog [SOAPUI-4059].


Regards

Henrik O
SmartBear Software


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
isanals
New Contributor

Re: Remove Empty Content

Hello!

I've just started testing with SoapUI and I have exactly the same problem to remove the empty content... I see it is in the "backlog SOAPUI-4059".
I use SoapUI Pro 4.6.0. and what I've read about 4.6.1 and 4.6.2, it is not implemented, isn't it? Please, has somebody found another way to solve it (Groovy, etc)? Or is there "combination of tools" in 4.6.1 or 4.6.2, that would help?

Regards
Isana
MarcusJ
Moderator

Re: Remove Empty Content

Hi,

Same question was asked on a different post.

Please see this post as a workaround:
viewtopic.php?f=4&t=21869


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
isanals
New Contributor

Re: Remove Empty Content

Hello Markus

Thank you for your feedback. But it doesnt work. What am I doing wrong?
I created an event RequestFilter.filterRequest and in "Target" I put the script you have mentioned:

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def stepName = context.getCurrentStep().getLabel()
def holder = groovyUtils.getXmlHolder( stepName + "#Request" )
for( item in holder.getDomNodes( "//*[. = '']" )){
holder.removeDomNodes("//"+item.nodeName)
}
// update request
holder.updateProperty()
// write updated request back to teststep
context.requestContent = holder.xml

Now the data from my xls are not read anymore from the Datasource. The request ist sent with the syntax the parameters as a string value. For example:
<callContext>
<caller>${DataSource_P#caller}</caller>
<user>${DataSource_P#user}</user>
<uuid>${DataSource_P#uuid}</uuid>
</callContext>

instead of:
<callContext>
<caller>T1</caller>
<user>hausi</user>
<uuid>uuidT1_1</uuid>
</callContext>

regards,
Isana

Re: Remove Empty Content

Hi Isana,

Instead of putting the script in "Target" try to put it in the text box below. As described here:
http://www.soapui.org/Scripting-Propert ... dlers.html

Thanks,
Michael Giller
SmartBear Software


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors