【发布时间】:2012-01-26 14:27:36
【问题描述】:
我有一个小问题。我必须将 NSDate 作为参数发送到肥皂网络方法。
[WbMethod]
public void Method(DateTime date){...
从objective-c我发送这样的数据:
NSDate* date = [NSDate date];
...
NSString *soapMsg =
[NSString stringWithFormat:
@"<?xml...
"<date>%d</date>"
...
"</soap:Body>"
"</soap:Envelope>", date
];
我收到错误:
...<faultstring>Server was unable to read request. ---> There is an error in XML document (1, 354). ---> The string '93462576' is not a valid AllXsd value.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
我也尝试将 %d 更改为 %@,然后错误是:
...faultstring>Server was unable to read request. ---> There is an error in XML document (1, 371). ---> The string '2012-01-26 14:27:45 +0000' is not a valid AllXsd value.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
【问题讨论】:
-
您的服务期望的日期格式是什么?时间戳,日期时间,也许是其他一些自定义“yyyMMddhhmm”?
-
SOAP 请求的日期应该采用什么格式?
-
DateTime 没有自定义格式。月/日/年 时、分、秒。
标签: iphone objective-c ios web-services soap