gpt4 book ai didi

ibm-mobilefirst - 在 IBM Worklight 中授权 HTTP 适配器

转载 作者:行者123 更新时间:2023-12-04 06:59:17 25 4
gpt4 key购买 nike

我正在努力让 HTTP 适配器请求到 protected rss 提要以正确执行。我已经阅读了大量 IBM 的文档,并寻找已移动或“正在维护”的 IBM 页面的死链接。不幸的是,我找到的所有示例都没有说明如何授权此请求。

为了这个示例,我尝试从 IBM Greenhouse Environment 中的 Connections 安装访问 rss 提要。

适配器 XML:

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="exampleAdapter"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>feedRead</displayName>
<description>feedRead</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain>greenhouse.lotus.com</domain>
<port>443</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getFeed" connectAs="server"/>
</wl:adapter>

适配器.js:

function getFeed() {
var input = {
method : 'get',
returnedContentType : 'xml',
path : 'connections/opensocial/basic/rest/activitystreams/@me/@all/@all? rollup=true&format=atom'
};
return WL.Server.invokeHttp(input);
}

如何传递访问此 Feed 所需的凭据?

谢谢!

最佳答案

您可以将身份验证机制指定为适配器 XML 文件的一部分。文档在这里:The Authentication element of the HTTP adapter .

目前我面前没有要检查的 Worklight Studio 实例,但我想应该有适配器 XML 的设计 View 或一些自动完成功能来帮助填写详细信息的指定方式在<authentication> block 。

示例:

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="exampleAdapter"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>feedRead</displayName>
<description>feedRead</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain>greenhouse.lotus.com</domain>
<port>443</port>
<authentication>
<basic/>
<serverIdentity>
<username> ${user} </username>
<password> ${password} </password>
</serverIdentity>
</authentication>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getFeed" connectAs="server"/>
</wl:adapter>

关于ibm-mobilefirst - 在 IBM Worklight 中授权 HTTP 适配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16921978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com