我已经建立了一个简单的 nodejs 服务器,只是为了查看我从适配器接收到哪些数据,并且一切正常。
我的适配器代码:
var input = {
method : 'post',
returnedContentType : 'plain',
path : "/mypath",
body:{
contentType:"application/json; charset=UTF-8",
content: JSON.stringify([{"item": "name"}])
}
};
return WL.Server.invokeHttp(input);
导致服务器输出:
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) URL :: /
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Method :: POST
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Header :: content-length=17
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Header :: content-type=application/json; charset=UTF-8
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Header :: host=localhost:1111
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Header :: connection=Keep-Alive
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Header :: user-agent=Apache-HttpClient/4.3.4 (java 1.5)
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Cookies >> undefined
Thu Dec 11 2014 11:18:47 GMT-0600 (CST) Body :: [{"item":"name"}]
问题可能出在您的后端...您从后端收到什么响应?将 returnedContentType : 'plain' 属性添加到您的调用选项并检查从 WL.Server.invokeHttp() 返回的内容