Forum Discussion

allon's avatar
allon
New Contributor
11 years ago

Remove Empty Content in TestRequest properties

Hi,

Could anyone help me with the 'Remove Empty Content' feature in TestRequest properties ?
I am using SoapUI 4.6.3 and SoapUI 5.0.0 and
let's say I have this element in my RQ with empty attributes:
<SegmentIDRef PriceClassCode="" PriceClassName="">F1</SegmentIDRef>

By enabling this feature (setting property value to 'true'), I was expecting to get
<SegmentIDRef>F1</SegmentIDRef>

but I am getting this in both SoapUI versions:
<SegmentIDRef PriceClassName="">F1</SegmentIDRef>

Thanks,

3 Replies

  • nmrao's avatar
    nmrao
    Icon for Champion Level 1 rankChampion Level 1
    If you see what you are getting, it looks it is removed one attribute of element, but not both attributes. It could be because that attribute might be mandatory in the schema, may be you can check.
  • allon's avatar
    allon
    New Contributor
    nmrao wrote:
    If you see what you are getting, it looks it is removed one attribute of element, but not both attributes. It could be because that attribute might be mandatory in the schema, may be you can check.


    Thank you for your response, nmrao.

    No, those attributes are optional in schema and I don't believe it has something to do with schema file(s) at all...
    SoapUI changes RQ before actually sending it to a host.
    I can easily remove all empty content using groovy script, but why do you need to invent a wheel if this SoapUI functionality is supposed to do the job for you ?

    Any ideas please, why only 1 empty attribute was removed instead of all ?
  • nmrao's avatar
    nmrao
    Icon for Champion Level 1 rankChampion Level 1
    Actually never happened to go thru the list of properties available for the request type. Thanks for that.

    Here is what I notice.

    If you have an element of a soap request which is mandatory and value has not been provided, the element is removed from the request on looking at raw xml.

    Tried with element which has an optional attribute, kept the value empty. In the raw request found the attribute is removed.

    Also found in another test that an element has 3 attributes allowed and 1 specific attribute is mandatory. Kept all the attribute values empty. When send the request, it has randomly kept one attribute in the request. So, for me it seemed like you running into this case. May be you can have one more check with other requests and see.

    Also you try validating your request by right click or key in Alt+v, then you will come to know in first place whether your request is correct and all mandatory elements/attributes are there.