<? 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控制台显示以下错误
输入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"
}
}
请提出任何建议。我无法点击网址,并记录输入的json。
答案 0 :(得分:1)
当您将带有application / json Content-Type标头的XML有效内容发送到ESB时,通常会出现此错误。我们在这里可以做的最好的事情是启用wirelogs并检查发送到ESB的HTTP头和有效负载。要启用wirelog,请按照以下步骤操作
转到$ ESB_HOME / repository / conf目录并找到 log4j.properties文件然后取消注释以下行
log4j.logger.org.apache.synapse.transport.http.wire = DEBUG
然后再次重新启动ESB实例并发送请求
监视ESB控制台的wirelogs,如下所示
符号&#39;&gt;&gt;&#39;给出写入ESB的内容和&#39;&lt;&lt;&lt;&lt;&lt;&#给出了ESB写的内容。
我也怀疑你的curl命令,因此下面给出了一个示例curl命令。
curl -v -d @test.json -H "Content-Type:application/json" http://localhost:8280/rest/api/createissue