首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >406在ODATA4j上执行post时不能接受

406在ODATA4j上执行post时不能接受
EN

Stack Overflow用户
提问于 2011-12-30 14:42:36
回答 1查看 419关注 0票数 0

我是odata4j概念的新手。使用tomcat库odata4j -0.5-nojpforforle.jar使用链接http://code.google.com/p/odata4j/wiki/Tomcat在odata4j上启动producer。我的生产者被修改为给出一个很大的整数列表,作为一个称为" integers“的实体集,我可以检索serviceDoc集合,并且可以应用过滤器。现在正在尝试对此服务文档执行post,尝试添加具有相同架构的多个条目。

使用post body为http://localhost:8080/OData/example.svc/Integers执行post:

代码语言:javascript
复制
    <?xml version="1.0" encoding="utf-8" ?>  <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <entry>   <id>http://localhost:8080/OData/example.svc/Integers(100)</id>  
<title type="text" />   
<updated>2011-12-29T10:50:33Z</updated>
<author>   <name />    </author>
<link rel="edit" title="Integers" href="Integers(100)" />  
<category term="example.Integers" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
<content type="application/xml"> 
 <m:properties>  
 <d:EntityId m:type="Edm.Int32">100</d:EntityId>    </m:properties>  
 </content>  
 </entry>

我收到406不可接受的未知内容类型application/xml;charset=UTF-8。Int集合内容类型为application/xml。仍然不能找出为什么会得到这样的回应。有人知道我错过了什么吗。

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-09 07:08:07

应用程序使用Content-Type

  • Entry /atom+ xml作为文档应该是元素(上面的xml不是格式良好的)

请参阅:http://www.odata.org/developers/protocols/operations#CreatingnewEntries

希望这能有所帮助,

  • john
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8676913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档