【发布时间】:2015-06-19 14:11:28
【问题描述】:
- 这是我在 WSO2 中的第一个 REST API,在 wso2 中的顺序如下。
<? xml version = "1.0" encoding = "UTF-8" ?>
< api xmlns = "http://ws.apache.org/ns/synapse"
name = "createIssue"
context = "/rest"
hostname = "XXX"
port = "XXX" >
< resource methods = "POST"
inSequence = "createInSequence"
`enter code here`
outSequence = "createOutSequence" >
< faultSequence / >
< /resource>
</api >
<? xml version = "1.0"
encoding = "UTF-8" ?>
< sequence xmlns = "http://ws.apache.org/ns/synapse"
name = "createInSequence" >
< log level = "custom" >
< property name = "location"
expression = "json-eval($.fields)" / >
< /log>
</sequence >
-
我调用 api 的 curl 命令如下。
'curl -X POST -H "Content-Type:application/json" -d@"h:\createissue_own.json" "http://ip:port/rest/api/createissue"'
-
WSo2 esb 控制台显示如下错误
newJsonPayload。无法保存 JSON 有效负载。找到无效的输入流。'
输入的 json,是一个有效的 json,我已经验证并在下面给出。
{
"fields": {
"project": {
"id": "10301"
},
"summary": "Issue",
"description": "Description text",
"issuetype": {
"id": "10205"
},
"customfield_10600": {
"id": "10300"
},
"customfield_10602": {
"id": "10301"
},
"customfield_10603": "ID text",
"customfield_10608": {
"id": "10303"
},
"customfield_10609": " text",
"customfield_10610": " text",
"customfield_10611": " text",
"customfield_10612": "Postcode text"
}
}
请有任何建议。我无法点击 url,并记录输入的 json。
【问题讨论】:
-
我的问题是 ws02 开发人员 eclipse - 使用 CAF 部署,但由于一个部署实例失败,它继续失败而没有显示错误。从 ESB 控制台中删除了 api 并进行了新的部署,它开始工作了。