我的WCF Web服务中有以下方法签名:
public CreateItemResult CreateAgent(int tenantId, string loginName, int timeZoneId)
如何在SOAP中为timeZoneId
传递Null值?我试图在我的SOAP请求中传递以下内容,但它不起作用:
<timeZoneId i:nil="true" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
我必须在我的WCF网络服务中将int timeZoneId
更改为int? timeZoneId
才能将Null值传递给它吗?还有其他方法吗?
谢谢!
答案 0 :(得分:0)
是,如果您想传递null,则需要使您的操作合同timeZoneId
可以为空(int?
)。否则,timeZoneId
元素在XSD架构中被视为不可为空。