我想在Soap UI中将DateTime字段传递为null值,一种选择是删除该标签。 还有其他方法可以在日期字段中传递null或其他值吗。
<rt6:DateofBirth></rt6:DateofBirth>
<rt6:DateofBirth></rt6:DateofBirth>
不是 null,但是是空字符串(在某些语言中不是这样),应该使用 xsi:nil="true"
,因此
<rt6:DateofBirth xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
请记住,正如Ali Baraka建议的那样,xsi命名空间可以在根标签级别上定义为xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
,这使您可以从常规标记中删除它。
一般回答:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
将以下内容加入根标签的命名空间。然后将此属性添加到标签中。
xsi:nil="true"
E.g:
<vp1:DateofBirth xsi:nil="true"></vp1:DateofBirth>
<rt6:DateofBirth xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
尝试传递一个高日期,如9999-12-31。这对我有用。
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
。我尝试了答案中提供的版本,但收到了验证错误。这是在SoapUI 4.6.4中发生的。 - David Dowdle/>
而不是仅使用了>
吗?也许你的模式不允许该字段为 null... - Betlista