2016-09-30 5 views
0

Alfrescoコミュニティ版 - 5.1.x。外部のWebサービスを呼び出すときに、私はないAlfresco:getttingエラーを呼び出す外部Webサービスが結果を取得できませんでしたか?

コードを結果として得ることができ、エラーを取得しています:

function updateList(){ 
    Alfresco.util.Ajax.request({ 

       url: "http://test.com/webservice/mgmobile/mgserver.php?wsfunction=course_get_all_courses&wstoken=7f5e0f05f7c54ece7a23f02fe3718464", 
     method: Alfresco.util.Ajax.GET, 

       headers: ('Access-Control-Allow-Origin: *'), 
       headers: ('Access-Control-Request-Headers: *'), 
       headers: ('Access-Control-Allow-Methods: *'), 
     requestContentType: Alfresco.util.Ajax.JSON, 
     successCallback:{ 
      fn: function(res){ 
       appendOptiOnvalues(res) 
      }, 
     }, 
     failureCallback:{ 
      fn: function(res){ 
       alert("Error"); 
      }, 
     } 
    }); 

} 

エラー:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://test.com/webservice/mgmobile/mgserver.php?wsfunction=course_get_all_courses&wstoken=7f5e0f05f7c54ece7a23f02fe3718464 . (Reason: missing token 'content-type' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channel).

はこれに助けてください。

+1

http://www.slideshare.net/jottley/cors-enable-alfresco-for-cors。これについて簡単に見ていただけますか? –

答えて

1

Alfresco以外のサーバーに電話がかけられているようですが、AlfrescoのCORSを設定することは役に立ちません。代わりに、呼び出しているサーバー上のCORS設定をチェックし、 "content-type"ヘッダーを指定できるように "Access-Control-Allow-Headers"を設定していることを確認してください。これはおそらくあなたが使用しているAlfresco AJAX utilライブラリによって設定されています。

あなたは呼び出しているサーバがわからないので、そのサーバに固有のCORSヘルプを提供することはできませんが、hereはさまざまなタイプのサーバでCORSを有効にするための情報です。

関連する問題