1

私の問題はこれです:

  • 開発環境では、すべて問題ありません。ポーラーは正常に動作しており、DB ステータスが変化しています。

  • 本番環境では、ログには何も表示されず、DB には何も変更されません (DB テーブルから通知を読み込んでいます)。


プッシュ通知イベントソース:

WL.Server.createEventSource({
    name : 'PushEventSource',
    poll : { 
        interval : 360, 
        onPoll : 'sendNotifications' 
    },
    securityTest : 'mobileSecTest' 
});


mobileSecTest セキュリティ テスト:

<mobileSecurityTest name="mobileSecTest"> 
    <testUser realm="LdapAdapterRealm"/>
    <testDeviceId provisioningType="none"/>
</mobileSecurityTest>


sendNotifications() の実装:

var notificationServicesResourceName = "PushAdapter";
function sendNotifications(){

WL.Logger.info('Starting to send notifications');
    var lockInvocationData = {
            adapter : "SQLConnector",
            procedure : "isLocked",
            parameters : [ notificationServicesResourceName ]
    };
    var isLockedResult = WL.Server.invokeProcedure(lockInvocationData);
    if (!isLockedResult.locked) {
        lockInvocationData = {
                adapter : "SQLConnector",
                procedure : "acquireLock",
                parameters : [ notificationServicesResourceName ]
        };
        WL.Server.invokeProcedure(lockInvocationData);

//Get the list of all notifications, from external database
        var dbResponse = getAllUnsentNotifications();

        var data = dbResponse.data ;

        /////////////////THE REST OF THE LONG LONG CODE ////////////
        //Reealse lock
        lockInvocationData = {
                adapter : "SQLConnector",
                procedure : "releaseLock",
                parameters : [ notificationServicesResourceName ]
        };
        WL.Server.invokeProcedure(lockInvocationData);
    }
}


アダプター XML ファイル:

<wl:adapter name="PushAdapter"
    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>PushAdapter</displayName>
    <description>PushAdapter</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>http</protocol>
            <domain>${com.ibm.moi.ci.host}</domain>
            <port>${com.ibm.moi.ci.port}</port> 
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="300" />
    </connectivity>
    <!-- Replace this with appropriate procedures -->
    <procedure name="sendNotifications"/>
    <procedure name="submitNotification"/>

</wl:adapter>
4

1 に答える 1

1

だから私は今これを実行しました。セキュリティ上の問題でした。Worklight Studio および Liberty Profile のローカル・ワークステーションでアプリケーションを実行すると、一部のセキュリティー機能が無効になりますが、これは実動の場合とは異なります。

開発モードでは、明示的な securityTest を持たないすべてのプロシージャには、デフォルトで wl_inprotected があります。Eclipse からプロシージャを呼び出せるようにするために、このようにしたと思います。運用環境ではセキュリティが強化されており、wl_unprotected はデフォルトのセキュリティ テストとは見なされていません。

だから私がしたことは、実行チェーン内のすべてのプロシージャに securityTest="wl_unprotected" を追加することです。

それでおしまい !

于 2014-01-18T16:53:29.027 に答える