17

I Want to Pass null value from Soap UI for Datetime Field one option is that i should delete the tag . There is any other way where i can pass null or some other value in date field.

 <rt6:DateofBirth></rt6:DateofBirth>
Betlista
  • 10,327
  • 13
  • 69
  • 110
Dilip
  • 697
  • 6
  • 16
  • 35

4 Answers4

23

<rt6:DateofBirth></rt6:DateofBirth> is not null, but empty String (not in all languages this is the same), use xsi:nil="true", so

<rt6:DateofBirth xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />

Bear in mind that, as Ali Baraka suggests, xsi namespace can be defined at root tag level as xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance", which allows you to remove from regular tags

Julio Nobre
  • 4,196
  • 3
  • 46
  • 49
Betlista
  • 10,327
  • 13
  • 69
  • 110
  • 8
    I had to use `xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"`. I tried the version the answer has but I received a validation error. This was in SoapUI 4.6.4. – David Dowdle Mar 13 '14 at 18:56
  • 1
    Are you sure, that you had `/>` a not only `>`? Maybe your schema do not allow nulls for the field... – Betlista Mar 14 '14 at 16:33
  • Does not seem to work in Soap UI 5.2.1 - I get an error "Attribute not allowed (no wildcards allowed): nil@http://w3.org/2001/...." despite the fact that in the WSDL my DateTime field is marked as nillable="true" – mutex Oct 20 '15 at 23:06
  • Can you open new question for that? You should share you XML and it will be solved, I'm sure ;-) – Betlista Oct 21 '15 at 06:56
  • This tells you where to put the namespace http://blog.ginzburgconsulting.com/null-values-in-soap-requests/ – infocyde Nov 29 '16 at 22:05
12

General answer:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

Add this to namespaces on root tag. Then add this property to tag

xsi:nil="true"

E.g:

<vp1:DateofBirth xsi:nil="true"></vp1:DateofBirth>
Ali Karaca
  • 3,365
  • 1
  • 35
  • 41
2

The following worked for me:

<rt6:DateofBirth xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
AGuyCalledGerald
  • 7,882
  • 17
  • 73
  • 120
0

try passing a high date like 9999-12-31. That worked for me.