大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全家桶1年46,售后保障稳定
Created by Jerry Wang on Jun 07, 2014
在browser里输入http url之后,
敲回车之后http自动转换成https:
通过httpwatch观察到有一个307 redirect:
通过tcode SMICM 查看ICM server设置:
发现server设置为所有http的request都会自动redirect成https, port number 44356:
debug下面report能找到redirect具体的处理细节:
data(url) = 'http://<XXXX>:50056/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zweb_add_2/001/s1/b1?sap-client=001'.
data(content) = zcl_crm_cm_tool=>get_text_by_url( conv #( url ) ).
[外链图片转存失败(img-XaYD1Q6e-1562035984810)(https://user-images.githubusercontent.com/5669954/27250812-b3764332-5338-11e7-9194-667707eb207e.png)]
get_text_by_url的方法实现如下:
method GET_TEXT_BY_URL.
DATA:lo_http_client TYPE REF TO if_http_client,
lv_status TYPE i,
lv_sysubrc TYPE sysubrc.
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = iv_url
IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
ASSERT sy-subrc = 0.
CALL METHOD lo_http_client->request->set_method( if_http_request=>co_request_method_get ).
*Disable pop-up when request receives unauthorized error: error 401.
"lo_http_client->propertytype_logon_popup = if_http_client=>co_disabled.
*Send request.
CALL METHOD lo_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
ASSERT sy-subrc = 0.
* Get response.
CALL METHOD lo_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
IF sy-subrc <> 0.
CALL METHOD lo_http_client->get_last_error
IMPORTING
code = lv_sysubrc
message = DATA(ev_message).
BREAK-POINT.
RETURN.
ENDIF.
ev_text = lo_http_client->response->get_cdata( ).
lo_http_client->close( ).
endmethod.
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/231332.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...