我正在使用Apache Axis與以.Net編寫的Web服務進行通信。Apache Axis - 日曆實例被序列化爲0001-01-01T00:00:00.000Z
當WS遇到DateTime.MinDate
(即「0001-01-01」)時,其中的一個功能有特殊處理。現在,我試圖將這個特殊值發送給WS,但是在Java中似乎沒有相當於DateTime.MinDate
。您可能知道,Axis將xsd:dateTime
換成Calendar
對象,所以我嘗試發送new GregorianCalendar(1 ,1 ,1);
,但這並沒有成功。我試過calendar.setTime(new Date(0))
,我試過很多更多的組合,但似乎沒有得到序列化爲
<endDate xsi:type="xsd:dateTime">0001-01-01T00:00:00.000Z</endDate>
這正是我需要的。有沒有人有任何線索如何實現?
相似的問題:http://stackoverflow.com/questions/4006186/java-equivalent-of-datetime-minvalue-datetime-today –
看到它,但它不是真的那麼相似...那個要求(我知道如何獲得新的GregorianCalendar(1,1,1);),但我需要一些將以與DateTime.MinDate相同的方式序列化爲SOAP xsd:dateTime的東西(即0001- 01-01T00:00:00.000Z)上述解決方案似乎沒有做到。 – kaqqao