调用POST服务表单XSJS时出现问题

2020-09-01 14:27发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,
我正在尝试从xsjs服务调用POST REST API,但出现以下错误- HttpClient.getResponse:无法从服务器获取响应:否 响应待处理...您必须先发出request()

以下是我的目的地和xsjs文件

http_dest

host =" https://l5471-iflmap.hcisbp。 us2.hana.ondemand.com "; pathPrefix ="/img/http"; 端口= 467; proxyType = http; proxyHost ="代理"; proxyPort = 8080; authType =基本; useSSL = false; sslHostCheck = false;

Test.xsjs

尝试{var destination; var client;

目的地= $ .net.http.readDestination(" DFT.RulesProject"," http_dest");

client = new $ .net.http.Client();

var request = new $ .net.http.Request($。net.http.POST,"/img/commonemail");

request.headers.set(" Content-Type"," application/json");

request.headers.set(" Accept"," application/json");

request.setBody(JSON.stringify({" mailParam":{" emailBody":" emailBody"," emailSubject":" emailSubject","收件人":" shubham.apatidar@incture.com "}})));

client.request(请求,目的地);

$ .response.setBody(JSON.stringify({

"成功":client.getResponse()。status,"代码":client.getResponse()})));

}

catch(e){$ .response.status = $ .net.http.INTERNAL_SERVER_ERROR; $ .response.setBody(e.message); }

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,
我正在尝试从xsjs服务调用POST REST API,但出现以下错误- HttpClient.getResponse:无法从服务器获取响应:否 响应待处理...您必须先发出request()

以下是我的目的地和xsjs文件

http_dest

host =" https://l5471-iflmap.hcisbp。 us2.hana.ondemand.com "; pathPrefix ="/img/http"; 端口= 467; proxyType = http; proxyHost ="代理"; proxyPort = 8080; authType =基本; useSSL = false; sslHostCheck = false;

Test.xsjs

尝试{var destination; var client;

目的地= $ .net.http.readDestination(" DFT.RulesProject"," http_dest");

client = new $ .net.http.Client();

var request = new $ .net.http.Request($。net.http.POST,"/img/commonemail");

request.headers.set(" Content-Type"," application/json");

request.headers.set(" Accept"," application/json");

request.setBody(JSON.stringify({" mailParam":{" emailBody":" emailBody"," emailSubject":" emailSubject","收件人":" shubham.apatidar@incture.com "}})));

client.request(请求,目的地);

$ .response.setBody(JSON.stringify({

"成功":client.getResponse()。status,"代码":client.getResponse()})));

}

catch(e){$ .response.status = $ .net.http.INTERNAL_SERVER_ERROR; $ .response.setBody(e.message); }

付费偷看设置
发送
2条回答
灬番茄
1楼 · 2020-09-01 14:44.采纳回答

在主机中,您具有HTTPS://。 您不应该在其中放置协议,而只能在主机名中放置。 另外,如果您确实将https作为目标的一部分,那么为什么要使用useSSL = false?

愤怒的猪头君
2楼-- · 2020-09-01 14:43

大家好,

万一我们调用托管在Cloud Foundry上的API,该怎么办? 我们需要在xsjs的Destination中配置什么帖子?

此致

拉吉夫

一周热门 更多>