cancel
Showing results for 
Search instead for 
Did you mean: 

datetime in webservice

cburghardt
Champ in-the-making
Champ in-the-making
Simple question: how do I set a custom property which is defined as d:datetime via CML? A CMLCreate takes a NamedValue[] as input but a NamedValue accepts only strings. I have tried to sent the date as ISO8601DateFormat because I found this in the converters but I always get the same error:
       {http://www.alfresco.org/ws/service/repository/1.0}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>The property value is not compatible with the type defined for the property:
   property: {http://www.inovox.de/model/1.0}date
   property value: PropertyValue[actual-type=DATE, multi-valued=false, value-type=STRING, value=2005-12-23 14:26:30,000]</ns1:message>
5 REPLIES 5

davidc
Star Contributor
Star Contributor
As you correctly found out, dates should be passed in ISO8601 format.  Try this format:

YYYY-MM-DDThh:mm:ss

cburghardt
Champ in-the-making
Champ in-the-making
Interesting, if I use your formatter (org.alfresco.util.ISO8601DateFormat) it works. If I use the formatter from the log4j package (org.apache.log4j.helpers.ISO8601DateFormat) it doesn't - probably because of the missing 'T'.

cburghardt
Champ in-the-making
Champ in-the-making
It seems that datetime properties are not correctly converted when they are retrieved with RepositoryService#query. The NamedValue contains something like "Sat Jan 07 23:51:38 CET 2006". If I am not mistaken this is produced in ResultSetQuerySession which does not use the DefaultTypeConverter but simply Object.toString().

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

Thanks for finding this.  I've created an entry in JIRA so this bug doesn't get lost.  You can track its progress here.

Cheers,
Roy

rwetherall
Confirmed Champ
Confirmed Champ
Should be fixed now …

————————————————————————

r2265 | royw | 2006-01-31 16:08:59 +0000 (Tue, 31 Jan 2006) | 1 line

Changed paths:

   M /alfresco/HEAD/root/projects/remote-api/source/java/org/alfresco/repo/webservice/repository/ResultSetQuerySession.java

————————————————————————