How third-party applications and services registered on the SAP Kyma

No. What the public before Jerry article? PHP also need to be developed in SAP China Research Institute in? He referred to a SAP Kyma application scenario:

Travel and social of people Ethan, after using WordPress site after SAP Kyma extension to write a blog. Ethan after each published a blog on WordPress, WordPress will secretly send a "blog to create" an event to Kyma example, and to create a good blog content delivery to Kyma as an event parameter. Event deployed on the latter's response function, call the major social media platforms create API created corresponding to the post. Such Ethan easily achieve the article, "the first release, the major platform blossom" purposes.
clipboard1,1

From the beginning of this article, Jerry will be introduced one by one extended scene of this technology step. The principle of the extension of the scene and mechanisms for the use of SAP Kyma SAP C / 4HANA be extended is the same. For example, the WordPress blog publishing event imagined as C / 4HANA Service Cloud to create an event in a service order, we can write the corresponding event handler on Kyma according to their actual business needs.

In the previous article What? PHP also need to be developed in SAP China Research Institute in? Jerry has been introduced in the Kyma how to install WordPress plug-in. It should be emphasized that, if an extension to the C / 4HANA with Kyma, then the latter for Kyma plug-ins, like WordPress plugin for Kyma, is responsible for providing and maintaining SAP, even if you do not know these details Jerry in this article, as well to complete the expansion and development work.

This article describes how to establish a connection of mutual trust between WordPress and Kyma instance, and will be released WordPress Kyma up to the specified event.

After the Kyma WordPress plugin installed, the setup options, the maintenance interface can see the corresponding Kyma connection.
The most important field here is the need to maintain a pointer to the url Kyma Application Connector service, that is the figure below fields "Kyma Connection".

clipboard2,2
以及在此处维护您到底想把WordPress的哪些事件,注册到Kyma上。
clipboard3,3

注册完毕后,在WordPress的Kyma插件界面里维护的这些事件,就会出现在Kyma service catalog(服务目录)界面里。通过这种事件注册机制,避免了WordPress和Kyma的紧耦合关系:工作于Kyma之上的扩展开发人员即使对WordPress的技术细节完全不了解,也丝毫不影响其扩展开发工作:只需要在Kyma的服务目录里,找到WordPress暴露出来的事件,用自己喜欢的编程语言开发对应的事件响应函数即可。

回到WordPress的Kyma维护界面里的Kyma Connection字段,到底需要维护什么样的url?

在Kyma里创建一个新的应用,点击Connection Application这个按钮,弹出来的这个对话框里的url即是我们要找的url.
clipboard4,4

在我们把url复制到WordPress的Kyma插件里之前,我们可以先在浏览器里访问这个url,看看会返回什么内容:
clipboard5,5

这个JSON响应的第一个字段csrUrl(Certificate Signing Request)和最后一个字段certificate,包含的信息用来生成用于在WordPress和kyma之间建立SSL连接所必需的数字证书。而api结构的几个字段则是Kyma Service Catalog注册的endpoint.

我们把这个url复制到WordPress的Kyma插件里,点击Connect按钮,即可发起指向Kyma实例的连接。

我们以调试模式启动本地WordPress,点击Connect按钮,

clipboard6,6

设置在class-connector.php的connect函数内的断点即触发。这个函数负责向传入的url发起HTTP GET请求,解析出Kyma返回的CSR url和Kyma服务目录的endpoint,然后再分别发起不同的HTTP post请求,去拿到Kyma返回的数字证书以及将WordPress的指定事件注册到Kyma上去。

clipboard7,7

Variable on line 73 $ body_json-> csrUrl is maintained Kyma's Certificate Signning Request url, a transmission line 75 to the post request url, get response:

clipboard8,8
Analytical certificate response contains the information, stored as a local file corresponding to:

clipboard9,9
Next Kyma and interaction instance, requires the use of digital certificates to these files are stored in WordPress locally:

clipboard10,10
The need to register to WordPress events on Kyma, is which format it uses is sent to Kyma?

clipboard11,11
clipboard12,12
Browser to access url: <hostname installation of wordpress> /index.php/wp-json, you can get a list of all API:

clipboard13,13
Kyma plugin for WordPress based event to be registered in the user interface plug-maintained, assembled into the corresponding JSON string is then sent Kyma through HTTP post:

clipboard14,14

After successful registration, the list of services and events Kyma console application interface where you can see the corresponding WordPress record:
clipboard15,15
while Kyma service directory, appeared before Jerry Kyma maintained in the WordPress plug-in interface in WordPress connector name and description:

clipboard16,16
So far registered on WordPress Kyma's successfully completed, is responsible for implementing WordPress incident response function developed by programmers can start work on Kyma. The development of this part, Jerry next article will continue to introduce.

This article describes WordPress Jerry during the actual operation of establishing connection with Kyma, I got my colleagues, SAP Chengdu Institute of C4C team of developers Li Sherry's strong support and help, thank here.

For more Jerry's original article, please pay attention to the public number "Wang Zixi":
公众号截图

Guess you like

Origin www.cnblogs.com/sap-jerry/p/11322587.html