首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSON格式的REST操作调用: WSO2DSS异常

JSON格式的REST操作调用: WSO2DSS异常
EN

Stack Overflow用户
提问于 2018-02-22 02:04:48
回答 1查看 159关注 0票数 0

按照下面的说明在curl命令中发送json请求有效载荷

https://docs.wso2.com/display/DSS351/JSON+Mapping+Sample

下面是curl命令:

代码语言:javascript
复制
D:\testing\curl-7.46.0-win64\bin>curl -X POST -H 'Accept: application/json'  -H 'Content-Type: application/json' --data "@article-payload.json" http://8.39.51.27:9763/services/KMTool/insertarticles

错误:

代码语言:javascript
复制
**Error: Getting below error:**
Warning: Couldn't read data from file "article-payload.json", this makes an
Warning: empty POST.
curl: (6) Could not resolve host: application
curl: (6) Could not resolve host: application
<axis2ns22:DataServiceFault xmlns:axis2ns22="http://ws.wso2.org/dataservice"><ax
is2ns22:current_params>{articleTitle=null, articlePath=null, articleContent=null
, articleDesc=null, categoryID=null}</axis2ns22:current_params><axis2ns22:source
_data_service><axis2ns22:data_service_name>KMTool</axis2ns22:data_service_name><
axis2ns22:description>N/A</axis2ns22:description><axis2ns22:location>\KMTool.dbs
</axis2ns22:location><axis2ns22:default_namespace>http://ws.wso2.org/dataservice
</axis2ns22:default_namespace></axis2ns22:source_data_service><axis2ns22:ds_code
>DATABASE_ERROR</axis2ns22:ds_code><axis2ns22:nested_exception>org.postgresql.ut
il.PSQLException: ERROR: null value in column "articleTitle" violates not-null c
onstraint
  Detail: Failing row contains (31, null, null, null, null, null).</axis2ns22:ne
sted_exception><axis2ns22:current_request_name>_postinsertarticles</axis2ns22:cu
rrent_request_name></axis2ns22:DataServiceFault>

我将文件保存在以下位置:

代码语言:javascript
复制
C:\Users\testUser\Downloads\wso2dss-3.5.1\repository\deployment\server\dataservices\article-payload.json

不知道是什么引起了问题。只需遵循wso2dss文档提供的说明。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-22 05:07:41

这些参数似乎没有正确传递(例如: articleTitle已变为null,但在数据库表中,您已将其定义为null列)。项目-Payload.json文件应该位于您试图使用curl调用请求的目录中。内部D:\testing\curl-7.46.0-win64bin)

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

https://stackoverflow.com/questions/48918480

复制
相关文章

相似问题

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