按照下面的说明在curl命令中发送json请求有效载荷
https://docs.wso2.com/display/DSS351/JSON+Mapping+Sample。
下面是curl命令:
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错误:
**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>我将文件保存在以下位置:
C:\Users\testUser\Downloads\wso2dss-3.5.1\repository\deployment\server\dataservices\article-payload.json不知道是什么引起了问题。只需遵循wso2dss文档提供的说明。
发布于 2018-02-22 05:07:41
这些参数似乎没有正确传递(例如: articleTitle已变为null,但在数据库表中,您已将其定义为null列)。项目-Payload.json文件应该位于您试图使用curl调用请求的目录中。内部D:\testing\curl-7.46.0-win64bin)
https://stackoverflow.com/questions/48918480
复制相似问题