0

我正在使用 spring ws 2.0.2.RELEASE

我有一个创建销售订单的 Web 服务

SOAP 调用中的两个元素是日期:

<ns3:requestedDate>2012-06-06T01:00:00.000+10:00</ns3:requestedDate>

<ns3:orderDate>2012-06-06T10:25:09.681+10:00</ns3:orderDate>

这两个字段都在模式中定义为 xs:dateTime

当我通过 SOAP 调用发送到我的服务时,我得到:

  <SOAP-ENV:Fault>

     <faultcode>SOAP-ENV:Client</faultcode>

     <faultstring xml:lang="en">Validation error</faultstring>

     <detail>

        <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-datatype-valid.1.2.1: '2012-06-06T01:00:00.000+10:00' is not a valid value for 'date'.</spring-ws:ValidationError>

        <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.3: The value '2012-06-06T01:00:00.000+10:00' of element 'ns3:requestedDate' is not valid.</spring-ws:ValidationError>

        <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-datatype-valid.1.2.1: '2012-06-06T10:25:09.681+10:00' is not a valid value for 'date'.</spring-ws:ValidationError>

        <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.3: The value '2012-06-06T10:25:09.681+10:00' of element 'ns3:orderDate' is not valid.</spring-ws:ValidationError>

     </detail>

  </SOAP-ENV:Fault>

知道为什么 Spring 将这些有效日期报告为无效吗?

4

2 回答 2

1

It seems if I pass in just the date portion '2012-06-06' it all works. I suppose the clue here should have been 'date' as opposed to 'datetime'. The end point being called must be expecting only a date.

于 2012-06-27T00:08:51.197 回答
0

可能是日期格式。它以格式解析日期,YYYY-MM-DD但许多验证器通过了基本上普遍接受的互联网格式DD-MM-YYYY. 最近在移动 safari 中验证表单时遇到了类似的问题。尝试更改日期格式,看看是否有效。

于 2012-06-26T02:57:53.483 回答