【发布时间】:2014-11-24 16:45:11
【问题描述】:
我是新来的,如果我在发布我的问题时出现任何错误,请见谅。我正在使用 SOAPUI 来测试 Web 服务。在 Soap 消息中,我需要添加 StartDate 和 EndDate 但我收到错误消息(输入字符串的格式不正确) 我一直在尝试通过 Internet 找到的几种 DateFormat,但仍然出现相同的错误。
这里有 SOAPUI 参数。
谢谢
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header>
<tem:Message>
<!--Optional:-->
<tem:Value>?</tem:Value>
</tem:Message>
<tem:APIKeyHeader>
<!--Optional:-->
<tem:Value>cbe40420</tem:Value>
</tem:APIKeyHeader>
</soapenv:Header>
<soapenv:Body>
<tem:GetTasks>
<!--Optional:-->
<tem:PIDs>
<!--Zero or more repetitions:-->
<tem:string>2857fd7c-a720</tem:string>
</tem:PIDs>
<!--Optional:-->
<tem:UserID>blue</tem:UserID>
<!--Optional:-->
<tem:IDs>
<!--Zero or more repetitions:-->
<tem:string>?</tem:string>
</tem:IDs>
<!--Optional:-->
<tem:TaskStatus>true</tem:TaskStatus>
<tem:StartDate>2008-10-26T21:32:52.12679</tem:StartDate>
<tem:EndDate>2014-10-26T21:32:52.12679</tem:EndDate>
<tem:ExtentionDays>true</tem:ExtentionDays>
<tem:ShowNotReady>false</tem:ShowNotReady>
</tem:GetTasks>
</soapenv:Body>
</soapenv:Envelope>
【问题讨论】:
-
您必须以网络服务期望的格式提供日期。哪种技术使用您的服务器?你能提供wsdl文件吗?我看到 StartDate 和 EndDate 是可选的。没有日期的请求是否有效?您可以尝试使用日期格式:2008-10-26T21:32:52
-
您好,感谢您的回复。 wsdl 文件在本地,因为我需要测试 Web 服务。该程序是用 c# 构建的,有人告诉我 SOAPUI 发送一个字符串,但程序需要 DateTime。必须插入日期。谢谢
-
错误是什么?当您询问开发人员时,他们对正确的日期格式有何看法?
-
尝试只发送年-月-日,如 YYYY-MM-DD 格式。您似乎没有发送字符串,而是您使用的日期格式与服务的预期不匹配。按照@SiKing 的建议去做。
-
您好,很抱歉耽搁了。有人告诉我 SOAPUI 发送任何格式的字符串,并且程序正在等待 DateTime。在发送请求之前有没有办法在soapui中转换?
标签: xml web-services soap soapui date-format