【发布时间】:2012-12-22 09:26:09
【问题描述】:
我的 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 Web 服务中将 int timeZoneId 更改为 int? timeZoneId 才能将 Null 值传递给它吗?还有其他方法吗?
谢谢!
【问题讨论】:
-
当您尝试通过
nulltimeZoneId时发生了什么?也许检查为您的服务生成的架构。如果minOccurs为 0,那么您应该可以完全省略该元素。如果您没有看到它,minOccurs默认为 1。查看使timeZoneId可以为空是否会更改架构。
标签: javascript ajax wcf soap null