我正在关注以下博客,以从XSJS调用示例服务。
我的样本服务
这是我的代码
var destination_package = "destPkg";
var destination_name = "dummydest";
var destination;
var client;
var request;
var employeeID;
try{
//Reading the destination properties
destination = $.net.http.readDestination(destination_package,destination_name);
//Creating HTTP Client
client = new $.net.http.Client();
//Creating Request
request = new $.web.WebRequest($.net.http.GET,"");
client.request(request,destination);
//Getting the response body and setting as output data
$.response.setBody(client.getResponse().body.asString());
}
catch(errorObj){
$.response.setBody(JSON.stringify({
ERROR : errorObj.message
}));
}
我的目的地
host = "postman-echo.com";
port = 443;
pathPrefix = "/get?foo1=bar1&foo2=bar2";
proxyType = none;
proxyHost = "";
proxyPort = 0;
authType = none;
useSSL = false;
timeout = 0;
一旦我测试了XSJS,它会给出以下错误
{“ ERROR”:“ HttpClient.getResponse:无法从 服务器:IPCon错误:\“到postman-echo.com的连接丢失,同时 阅读响应。\“”}