How to send null values in soapUI requests
soapUI is a pretty useful web service testing tool that can help you generate a multitude of tests like load testing, functional testing, data consistency testing and many more. I have started using it for real two days ago when I needed to test some SOAP web services for work. The main issue that kept me from being more productive with this test platform was that nowhere in its documentation one can find how to send null values in a request.
In the soapUI User Guide, in the “Working with Web Service Request” there is a tricky property called Remove Empty Content.
Remove Empty Content : Removes empty elements/attributes from outgoing requests. This can be useful in Data Drive TestRequests which contain elements/attributes that not always contain data and should be removed in those cases.
What I understand from this property is that if I have an empty field that I would like not to be transmitted further into my request, setting this property to true, the field will be marked as null and transmitted like that. Well, the result isn’t the one you would have expected. Doing like that will only bring you more and more frustrations as the only thing you will obtain will be a beautifully crafted server error complaining that some fields don’t have proper values (the errors are more technical like “invalid date format or argument“, “value expected for … field“).
So, answering the question “How to send null data in a request with soapUI?“, the thing that you should do is to mark the respective field like this:
<ns :field xmlns:field="http://www.w3.org/2001/XMLSchema-instance" field:nil="true" />
or, assuming that you do not want to write this kind of attributes for many empty fields in a request, something like this:
<?xml version="1.0" encoding="utf-8"?>
<soap :Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soapbody>
<parenttag>
<childtag1>value</childtag1>
<childtag2 xsi:nil="true" />
<childtag2 xsi:nil="true" />
</parenttag>
</soapbody>
</soap>
Enjoy!
You might also like:
1 Comment
Leave a comment
Recent Posts
Projects that I support
Recent Comments
nope said:
yeah that was my first thought too, but: mount: warning: seems to be mounted read-write. too bad, would have been just perfect. more»Klaus Deiss said:
Dear Radu, I tried it on Ubuntu 10.0.4.2 and 10.0.4.3 with different kernel versions (amd64 server 2.6.32 kernel). No... more»scompo said:
Nope.. Now it’s not working again.. This printer it’s a real pain in the butt.. The other hp printer I had... more»Dmitrij said:
Thank you Peter and Patrice. Could you please post the updated script? more»hd_flash_pains said:
didn’t work for me more»








Thank you for your post I really liked it:)
We will link to your blog from our website