locked
Calling External Webservice(API) from JScript RRS feed

  • Question

  • I am trying to call an external webservice using SOAP from CRM Form and it gives me access denied error (0x800a0046 - JavaScript runtime error: Permission denied).

    Any idea or do you suggest any other options to get data from external service through JavaScript?

    Thanks in advance.

    Regards,

    Krutika Suchak

    Wednesday, May 20, 2015 2:38 PM

All replies

  • Can you post a snippet of your code?  Might help to track down the problem.
    Wednesday, May 20, 2015 5:34 PM
  • Hi Krutika,

    Please check this link if this is useful for you. 


    Regards, Rekha.J

    Thursday, May 21, 2015 5:46 AM
  • 1. I've tried to call API with SOAP call.

    2. I've tried JQuery for Cross Domain calls, that works fine for the server which are using (http) but fails for the server which are using (https)

    Here is the code -

     $.ajax({
                        url: 'external link',
                        type: 'GET',
                        dataType: 'json',
                        crossDomain: true,
                        success: function (data, textStatus, xhr) {
                            console.log(data);
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            console.log(errorThrown);
                        }
                    });
    }

    and its calling JQuery 1.11.3 version where its failing at this point -

    xhr.open( options.type, options.url, options.async, options.username, options.password );

    Regards,

    Krutika Suchak

    Wednesday, May 27, 2015 9:48 AM
  • Hi Rekha,

    I am not really sure will this help to call from Jscript in CRM. Have you tried this earlier?

    Regards,

    Krutika

    Wednesday, May 27, 2015 9:50 AM
  • add the below to your code

    $.support.cors  = true;

    • Proposed as answer by Chadi T Wednesday, May 27, 2015 9:57 AM
    • Unproposed as answer by Chadi T Tuesday, June 2, 2015 5:21 AM
    Wednesday, May 27, 2015 9:56 AM
  • I tried this option but no luck.
    Thursday, May 28, 2015 12:20 PM