株洲网站网络推广怎么做建站系统哪个比较好
主要是CPI要用到WSDL文件做mapping,客户的SAP服务器不一定直接可在浏览器访问http或者https的地址,所以在SAP里面开发程序内部调用地址获取WSDL文件
*&---------------------------------------------------------------------*
*& Report YXX_GET_WSDL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT yxx_get_wsdl.DATA: gv_url TYPE string,gv_protocol TYPE string,gv_host TYPE rfcdisplay-rfchost,gv_ip TYPE rfcdisplay-rfchost,gv_port TYPE string,gv_resp TYPE string,gv_path TYPE string,gv_fullpath TYPE string,gv_extension TYPE string,gv_filename TYPE string,go_http_client TYPE REF TO if_http_client,gt_resp TYPE TABLE OF string,gt_service_info TYPE TABLE OF icm_sinfo2.SELECTION-SCREEN BEGIN OF BLOCK blk01 WITH FRAME TITLE TEXT-101.PARAMETERS: p_rfc TYPE rs38l-name OBLIGATORY MATCHCODE OBJECT sfunc_modules.SELECTION-SCREEN END OF BLOCK blk01.START-OF-SELECTION." 检查函数名SELECT SINGLEfuncnameFROM tfdirWHEREfuncname = @p_rfcINTO @DATA(ls_tfdir).IF sy-subrc <> 0.MESSAGE '函数不存在' TYPE 'E'.ENDIF." 获取ipgv_host = sy-host.CALL FUNCTION 'RFC_HOST_TO_IP'EXPORTINGrfchost = gv_hostIMPORTINGrfcip = gv_ip." 获取http端口CALL FUNCTION 'ICM_GET_INFO2'TABLESservlist = gt_service_info.gv_port = VALUE #( gt_service_info[ protocol = 1 ]-service OPTIONAL ). " HTTP 端口gv_protocol = 'http'.IF gv_port IS INITIAL.gv_port = VALUE #( gt_service_info[ protocol = 2 ]-service OPTIONAL ). " HTTPS 端口gv_protocol = 'https'.ENDIF." WSDL地址 使用之前需要在SICF Service Tree中激活WSDL服务的地址才可以访问gv_url = |{ gv_protocol }://{ gv_ip }:{ gv_port }/sap/bc/soap/wsdl11?services={ p_rfc }&sap-client={ sy-mandt }|." 调用WSDL地址cl_http_client=>create_by_url(EXPORTINGurl = gv_urlIMPORTINGclient = go_http_clientEXCEPTIONSargument_not_found = 1plugin_not_active = 2internal_error = 3OTHERS = 4 ).IF sy-subrc <> 0.MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITHsy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.EXIT.ENDIF." 设置授权go_http_client->request->set_content_type( content_type = 'application/xml; charset=utf-8' ).go_http_client->request->set_authorization( username = CONV #( sy-uname ) password = CONV string( '' ) ).go_http_client->authenticate( username = CONV #( sy-uname ) password = CONV string( '' ) ).go_http_client->request->set_method( if_http_request=>co_request_method_post )." 发送请求go_http_client->send( EXCEPTIONS http_communication_failure = 1http_invalid_state = 2 )." 读取远程服务返回的结果消息。go_http_client->receive( EXCEPTIONS http_communication_failure = 1http_invalid_state = 2http_processing_failed = 3 ).IF sy-subrc <> 0."操作失败,获取失败原因go_http_client->get_last_error( IMPORTING message = DATA(lv_message) ).MESSAGE lv_message TYPE 'E'.ELSE.gv_resp = go_http_client->response->get_cdata( )." 选择文件保存路径cl_gui_frontend_services=>file_save_dialog(EXPORTINGdefault_extension = 'WSDL'default_file_name = CONV string( p_rfc )CHANGINGfilename = gv_filenamepath = gv_pathfullpath = gv_fullpathEXCEPTIONSOTHERS = 1 ).IF sy-subrc <> 0 OR gv_fullpath IS INITIAL.MESSAGE '未选择文件保存路径' TYPE 'E'. " 未选择文件保存路径RETURN.ENDIF.APPEND gv_resp TO gt_resp." 下载本地CALL FUNCTION 'GUI_DOWNLOAD'EXPORTINGfilename = gv_fullpathfiletype = 'DAT'TABLESdata_tab = gt_resp.ENDIF.