我正在尝试使用JSON格式(使用Chrome的附加组件Advanced Rest Api)在Restful服务器上执行POST请求。下面是JSON字符串:(标题: Accept: application/json;Authorization: Basic...)
{
"datecreated": 1355237359326,
"datemodified": 1355237359326,
"entrylocation": "Düdingen",
"entrydate": 1347351720000,
"entryduration": 11900,
"comment": "Random text",
"publicvisible": 2,
-
"coursetype": "Running track (Outdoor)",
"courselength": 600,
"numberofrounds": 12,
"track": "Fast track"
}我得到以下错误:
Can not instantiate abstract type [simple type, class ch.unifr.cybercoach.server.entities.jaxb.entries.Entry] (need to add/enable type information?)
at [Source: org.eclipse.jetty.server.HttpInput@65ab8182; line: 1, column: 2]这很奇怪,因为相同的POST请求适用于XML格式:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entryrunning>
<comment>Random text</comment>
<entrydate>2012-09-11T10:22:00+02:00</entrydate>
<entryduration>11900</entryduration>
<entrylocation>Düdingen</entrylocation>
<publicvisible>2</publicvisible>
<courselength>600</courselength>
<coursetype>Running track (Outdoor)</coursetype>
<numberofrounds>12</numberofrounds>
<track>
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGttbCB4bWxucz0iaHR0cDovL3d3dy5vcGVuZ2lzLm5ldC9rbWwvMi4yIj4KICA8RG9jdW1lbnQ+CiAgICAgICAgICA8L1BvbHlnb24+CiAgICAgICAgPC9QbGFjZW1hcms+CiAgICAgIDwvRm9sZGVyPgogICAgPC9Gb2xkZXI+CiAgPC9Eb2N1bWVudD4KPC9rbWw+Cg==</track>
</entryrunning>有谁有什么想法吗?
首先要感谢大家!
发布于 2012-12-13 05:20:19
事实证明sys.stderr是对的--谢谢你(参见我的问题帖子下面的评论)。解组在服务器端有一个问题。现在这个问题已经解决了,下面的json字符串运行得很好:
{"entryrunning" :{
"datecreated": 1355237359326,
"datemodified": 1355237359326,
"entrylocation": "Düdingen",
"entrydate": 1347351720000,
"entryduration": 11900,
"comment": "Random text",
"publicvisible": 2,
"coursetype": "Running track (Outdoor)",
"courselength": 600,
"numberofrounds": 12,
"track": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGttbCB4bWxucz0iaHR0cDovL3d3dy5vcGVuZ2lzLm5ldC9rbWwvMi4yIj4KICA8RG9jdW1lbnQ+CiAgICAgICAgICA8L1BvbHlnb24+CiAgICAgICAgPC9QbGFjZW1hcms+CiAgICAgIDwvRm9sZGVyPgogICAgPC9Gb2xkZXI+CiAgPC9Eb2N1bWVudD4KPC9rbWw+Cg=="
}}https://stackoverflow.com/questions/13823615
复制相似问题