SAP Cloud for Customer的 HTML Mashup渲染原理

举报
Jerry Wang 发表于 2022/03/31 18:26:21 2022/03/31
【摘要】 HTMLContainer:sHtmlContent就是之前在SAP C4C mashup编辑页面维护的html代码:MashupServerUri:“https://mashup-cn.sapbydesignmashups.cn”“https://mashup-cn.sapbydesignmashups.cn/mashups/html/container.html”拿到iframe dom...

HTMLContainer:

sHtmlContent就是之前在SAP C4C mashup编辑页面维护的html代码:

MashupServerUri:“https://mashup-cn.sapbydesignmashups.cn


https://mashup-cn.sapbydesignmashups.cn/mashups/html/container.html

拿到iframe dom:

setSourceUri之后重新渲染:


进入_endRenderHtml:

sMessage的值:


观察到一个HTTP post操作:



场景:SAP云平台上的两个ABAP系统实例,一个作为数据的提供者-provision system;另一个作为数据的消费者 - client system,后者从前者读取数据,并显示

实现步骤概述:

(1) client System创建outbound communication.
(2) 在provision系统创建inbound communication.
(3) Create a Service Consumption Model, and save this locally as a $metadata XML file; From this you will create proxy artefacts in the client system, representing the remote service, and use this model to generate an abstract entity.
(4) 创建一个remote client proxy
(5) 在client System创建一个OData服务,使用Fiori Elements消费并展示从provision系统取回的数据

SAP标准发布的Communication Scenario SAP_COM_0276,提供了SAP Cloud Platform ABAP实例同远端的ABAP On-Premises系统或者第三方系统集成的可能性。

A communication arrangement specifies the metadata for a specific communication scenario, such as your host system and the authentication method. This metadata is contained in a service key. You can then define one or more specific destinations for this arrangement.

Communication Arrangement为Communication Scenario指定了必须的元数据,包括通信系统和消息认证方式等信息,这些元数据以Service key的形式存储。可以基于Communication Arrangement创建Destination.

在SAP云平台CloudFoundry环境里创建一个Destination服务实例:



基于这个Destination服务创建一个新的Destination实例:


url字段维护成provision System的url,确保连接能够成功建立。

给Destination service创建一个新的service key,将其内容保存在本地:

在client System上打开ABAP service instance的dashboard:



在Communication Arrangement tile里,创建一个新的实例:

从Communication Scenario下拉列表里,选择之前介绍的SAP_COM_0276: SAP CP CF Destination Service integration:


选择好Communication Scenario后,维护Communication Arrangement的名称,比如OUTBOUND_XXX.

在Communication Arrangement的additional properties里,将service instance name的值从默认值OUTBOUND_XXX改成更便于记忆的值,比如Outbound-For-Tutorials_XXX.

最后一步,在ABAP client System上创建ABAP 实现类:

CLASS ZCL_OUTPUT_HTTP_XXX DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.
    INTERFACES if_oo_adt_classrun.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS ZCL_OUTPUT_HTTP_XXX IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.

     TRY.

        DATA(lo_destination) = cl_http_destination_provider=>create_by_cloud_destination(
          i_name                  = 'A4C_ACCESS_XXX_HTTP'
          i_service_instance_name = 'Outbound-For-Tutorial-XXX'

          i_authn_mode = if_a4c_cp_service=>service_specific ).

        DATA(lo_http_client) = cl_web_http_client_manager=>create_by_http_destination( i_destination = lo_destination ).
        DATA(lo_request) = lo_http_client->get_http_request( ).

        DATA(lo_response) = lo_http_client->execute( i_method = if_web_http_client=>get ).
          out->write( lo_response->get_text( ) ).

      CATCH cx_root INTO DATA(lx_exception).
        out->write( lx_exception->get_text( ) ).

      ENDTRY.

  ENDMETHOD.

ENDCLASS.

第18行的参数i_name的值,就是之前在SAP Cloud Platform里创建的Destination名称。

i_service_instance_name, 就是创建的Communication Arrangement additional properties里创建的Service instance name的值。

执行ABAP类,测试结果如下:

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。