Ibm mobilefirst 从PHP脚本调用适配器

Ibm mobilefirst 从PHP脚本调用适配器,ibm-mobilefirst,mobilefirst-adapters,Ibm Mobilefirst,Mobilefirst Adapters,我正在向所有设备发送推送通知,为此,我为基于标签的推送通知创建了适配器,如下所示 function sendTagNotification(applicationId, notificationText, notificationTags) { var notificationOptions = {}; notificationOptions.message = {}; notificationOptions.target = {}; var tags = no

我正在向所有设备发送推送通知,为此,我为基于标签的推送通知创建了适配器,如下所示

function sendTagNotification(applicationId, notificationText, notificationTags) {
    var notificationOptions = {};
    notificationOptions.message = {};
    notificationOptions.target = {};

    var tags = notificationTags.split(",");

    notificationOptions.message.alert = notificationText;
    notificationOptions.target.tagNames = tags;

    WL.Server.sendMessage(applicationId, notificationOptions);

    return {
        result : "Notification sent to users subscribed to the tag(s): '" + notificationTags + "'."
    };
}
现在我们想要的方法是,我们将使用php脚本将消息内容发送到Worklight Adapter,
sendTagNotification
Adapter将接收消息内容并将其发送给所有移动用户


那么有什么方法可以从PHP脚本调用适配器呢?

假设您使用的是MobileFirst 7.0及以上版本,并且您的适配器过程受到安全测试的保护,那么您需要实现所谓的“机密客户端”,以便充当处理OAuth挑战的OAuth客户端:

另一种方法是让PHP脚本调用适配器过程URL,但必须使用securityTest=“wl\u unprotected”取消对适配器过程的保护。例如,使用curl,URL主体中的参数为:
curlhttp://my-host:my-端口/项目上下文根/适配器/适配器名称/过程名称

如果使用MobileFirst 6.3,您可以从Studio调用适配器过程(右键单击适配器文件夹并选择运行方式>调用MobileFirst适配器过程),然后输入一些详细信息。将打开一个浏览器窗口


您应该能够复制将在那里的URL并调整脚本中附加的参数…

我们的客户端正在使用
v6.3
,因此我想我必须选择第二个选项,我了解访问适配器的url部分,但如何传递参数我正在获取
java.lang.RuntimeException:java.io.FileNotFoundException:File not found:/adapters/WLPush/sendTagNotification
我的终点是
http://192.168.100.32:10080/RR_MobileApp/adapters/WLPush/sendTagNotification
实际上,如果您是使用6.3这个URL结构是行不通的。它假定REST也是7.0及以上版本的一部分。。。嗯,我会再打给你的。。。