Closed GoogleCodeExporter closed 9 years ago
here is the same example using a JSON request:
Request:
POST http://127.0.0.1:8888/datastore.svc/Appointment(202) HTTP/1.1
Origin: http://127.0.0.1:8888
X-HTTP-Method: MERGE
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.24 (KHTML, like
Gecko) Chrome/19.0.1055.1 Safari/535.24
Content-Type: application/json
Accept: application/atomsvc+xml;q=0.8, application/json;q=0.5, */*;q=0.1
Referer: http://127.0.0.1:8888/home
DataServiceVersion: 1.0
{"startDate":"/Date(1330479000000)/","endDate":"/Date(1330488000000)/","descript
ion":"","name":"asgvsaerg"}
Resulting entity object:
OEntity[OProperty[startDate,EdmSimpleType[Edm.DateTime],2012-02-29T01:30:00.000]
,OProperty[endDate,EdmSimpleType[Edm.DateTime],2012-02-29T04:00:00.000],OPropert
y[description,EdmSimpleType[Edm.String],],OProperty[name,EdmSimpleType[Edm.Strin
g],asgvsaerg]]
Original comment by miguel.ans@gmail.com
on 2 Mar 2012 at 11:47
And... this is also happening while creating an entity.
Original comment by miguel.ans@gmail.com
on 2 Mar 2012 at 11:51
This problem most probably comes from a missing "type" attribute on the
property element. If the edm type of a property is not defined in the feed,
odata4j currently resolves it as Edm.String. I had a similar issue where a
complex type arrived without type information which breaks feed parsing
completely.
You could either change your service to include the proper "type" attribute or
try to apply the patch attached to issue 143 to the current 0.6 snapshot. This
tries to derive the edm type by looking it up in the service metadata.
Original comment by manuel.r...@gmail.com
on 8 Mar 2012 at 2:57
[deleted comment]
Thanks for your suggestion but I've tried with odata4j 0.6.0 and the problem
still exists. I suppose the correct behavior would be to infer the property
type by the metadata and not by what the client sends, right?
Original comment by miguel.ans@gmail.com
on 21 Mar 2012 at 11:58
The patch hasn't been integrated with odata4j yet. You would have to clone
odata4j project, apply the patch and build the distribution jar files. Another
option would be to define the property type attributes in the POST request's
xml payload.
Original comment by manuel.r...@gmail.com
on 21 Mar 2012 at 2:32
I'm not using Atom currently in my project so I can wait until it's integrated
in odata4j. Do you have any idea when will this be?
Thank you very much for your help.
Original comment by miguel.ans@gmail.com
on 23 Mar 2012 at 8:28
In the latest codebase, we use the property type if we have the metadata.
Please reopen if you still see this after running against latest.
Original comment by john.spurlock
on 10 Nov 2012 at 11:43
Original issue reported on code.google.com by
miguel.ans@gmail.com
on 2 Mar 2012 at 11:44