4

I am very new to Tridion and am starting to play around with consuming the content delivery web service in Java.

The problem I am seeing is the similar to this post, https://stackoverflow.com/questions/9207354/odata4j-exceptions-odd-number-of-characters-and-bad-valuestring-part-of-key. The tl;dr is that for some reason the content delivery web service is labeling an attribute type as Edm.DateTime but is sending it as an Edm.DateTimeOffset like so:

<d:CreationDate m:type="Edm.DateTime">2014-04-28T20:53:36-04:00</d:CreationDate>

Is there a way to configure this? I have looked through all of the cd_*_.xml files but am unable to find anything that looks like what I would expect to see. The poster in the link above mentions a solution:

The fix is very simple if you have access to the OData Producer code:

and shows how to modify the code but I am not sure if I have access to the web service producer code via Tridion. Thanks in advance for your help!

Edit: Sorry, I should have mentioned that we are using Tridion 2013 SP1.

  • What version of Tridion you are using? Tridion 2011 SP1 ? – Ram G May 23 '14 at 14:01
  • I've edited my question, we are using 2013 SP1. – chris.lydon May 23 '14 at 14:21
  • 1
    Follow the below link on the solution, I haven't checked 2013 SP1 OData WS if the same issue exists but it seems to be the same as Tridion 2011 SP1. – Ram G May 23 '14 at 14:23
4

There is known bug with OData Tridion 2011 SP1 OData Web Service. Please follow this link from one of Tridion Expert (Mihai) : http://yatb.mitza.net/2013/07/a-java-service-oriented-architecture.html (Look for the below section) You don't need to modify the producer code, you can simply modify the odata4j client code.

Trouble with Edm.DateTime

There seems to be a bug in Tridion 2011SP1 CD WS -- the format of Edm.DateTime values (the Tridion dates) are in invalid format according to the OData specification. The values coming from OData contain timezone information, while they should not. The OData Edm.DateTime format does not allow timezone information. There is however an OData type Edm.DateTimeOffset, which allows the date formats with timezone information.

When using the OOTB OData4j libraries, you would get an Illegal datetime format exception. I fixed this issue by patching OData4j library (thank you for being open source! ;-) ).

In class org.odata4j.internal.InternalUtil, change the method parseDateTimeFromXml, and comment the throw statement at the end. Instead, delegate the parsing to parseDateTimeOffsetFromXml.

... return parseDateTimeOffsetFromXml(value).toLocalDateTime(); // throw new IllegalArgumentException("Illegal datetime format " + value); }

The new patched odata4j-0.7.0-clientbundle-patched.jar is available in my Google Code project.

  • Sure, this is one option I have considered but the issue remains that Tridion is labeling the attribute incorrectly. I guess what you are saying is that there is no way to fix this on the Tridion side? – chris.lydon May 23 '14 at 14:31
  • 1
    The only way to change on Tridion side is by updating the product code for OData mappings, which is not the supported way and you need workarounds (jad) to get the source code which is not recommended. It will be relatively easy with modifying with OData client. Also, you could open a customer support ticket reporting the issue so may be in the future releases it will be addressed appropriately. – Ram G May 23 '14 at 15:01
  • I was pretty sure we had fixed this on 2013 SP1... I'll double check. – Nuno Linhares May 23 '14 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.