Radu Cotescu's professional blog

g33k w17h pa45510n

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/">
        <childtag2 xsi:nil="true" />
        <childtag2 xsi:nil="true" />


Code, How To, Web Services

« Ubuntu 9.04 Jaunty Jackalope pros and cons How to install VMware Server 2.0.1 on Ubuntu 9.04 Jaunty Jackalope »