API连接错误

2020-09-14 14:08发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中) 大家好, 我们正在...

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

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


大家好,

我们正在尝试在ecc服务器中测试SAP_API功能之一,但出现以下错误。

错误:-

测试API 1

响应:
应用服务器错误404找不到资源未到达合作伙伴##使用标签:{00000366}记录了错误

下面的动作到目前为止一直进行测试,

1。 在000中,客户端为此连接配置了代理设置。

2。在SSL客户端标准中应用了证书(已安装Github证书)

3。 重新启动ICM。

4。 最后尝试执行以下报告,

报告:-////////////

*&------------------------------------------ --------------------------- *
*&报告API_TEST
*&
*&----- -------------------------------------------------- -------------- *
*&
*&
*&-------------------- ------------------------------------------------- *

报告API_TEST。
数据:lo_http_client类型引用if_http_client。
数据:响应类型字符串。

"通过url创建HTTP客户端"
" API沙箱的API端点
调用方法cl_http_client => create_by_url
导出
url =' https://sandbox.api.sap.com/translationhub/api/v1/domains '
"具有可选查询参数的API端点
" url =' https://sandbox.api.sap.com/translationhub/api/v1/域'

导入
客户端= lo_http_client
例外情况
arguments_not_found = 1
plugin_not_active = 2
internal_error = 3
其他=4。

"可用的API端点
" https://saptranslation- {subaccountname}。 hanatrial.ondemand.com/translationhub/api/v1
"https://sap {providersubaccountname}-{subscriptionsubaccountname}。 hana.ondemand.com/translationhub/api/v1
" https://sap {providersubaccountname}-{subscriptionsubaccountname}。 ap1.hana.ondemand.com/translationhub/api/v1
" https://sap {providersubaccountname}-{subscriptionsubaccountname}。 eu1.hana.ondemand.com/translationhub/api/v1
"https://sap {providersubaccountname}-{subscriptionsubaccountname}。 us1.hana.ondemand.com/translationhub/api/v1
" https: //sap {providersubaccountname}-{subscriptionsubaccountname}。 us2.hana.ondemand .com/translationhub/api/v1

IF sy-subrc <>0。
"错误处理
ENDIF。

"设置请求方法
lo_http_client-> request-> set_method('GET')。
"添加标头
lo_http_client-> request-> set_header_field(name ='Content-Type'value ='string')。
lo_http_client-> request-> set_header_field(name ='Accept'value ='application/json; charset = utf-8')。
" API沙箱的API密钥
lo_http_client-> request-> set_header_field(name ='APIKey'value ='Our Value')。

"用于生产性API端点的可用安全性方案
"基本身份验证
"基本身份验证:在授权标头中编码的Base64中提供用户名:密码
" lo_http_client-> request-> set_header_field(名称 ='授权'值='')。 = 4
其他=5。
如果sy-subrc =0。
呼叫方法lo_http_client-> receive
例外情况
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS =5。
ENDIF。

IF sy-subrc <>0。
"错误处理
ENDIF。


response = lo_http_client-> response- > get_cdata()。

WRITE:"响应:",响应。

//////////////////////////////////////////////////////////////////////////////

我的查询很少,要使该报告发挥作用,我们需要执行哪些必要条件。

1。 我们是否需要为此通信设置任何RFC连接?

2。 有没有要打开的端口?

请把您所有的想法放在这里。

非常感谢您对此查询的输入。

谢谢

Pradeep。

2条回答
落灬小鱼
2020-09-14 14:50 .采纳回答

大家好,

在将sandbox.api.sap网站证书应用于strust中的sap abap系统后,问题已解决。

感谢您的帮助。

谢谢

Pradeep。

一周热门 更多>