locked
Cannot get REST to work with JavaScript in CRM 2011 RRS feed

  • Question

  • I'm having a lot of trouble trying to get this to work, having read the SDK etc.

    I am basically trying to access the Organization Service by REST from within a form when something happens.

    The URL for this service is http://myserverName/MyCrmName/XRMServices/2011/OrganizationData.svc/ (found by using Developer Resources and it resolves correctly)

    In the form I have loaded SDK.REST.JS and JSON.JS from the SDK samples.

    I ensure that in the SDK.REST library I have edited the getServerUrl() method to ensure it does not use the deprecated getServeUrl method but rather the getClientUrl method. Ultimately I am ensuring that this library sets up the web request with

    /myserverName/MyCrmName/XRMServices/2011/OrganizationData.svc/ (if I include the "http//" I get an Access /Denied).

    My code to call into the sdk.rest.retrieveMultipleRecords is

    MyOrg.Cases.onRegardingFoiChanged = function () {
            SDK.REST.retrieveMultipleRecords(
         "Account",
         "$select=Name",
         function (results) {
             alert("success");
         },
         function (error){
             alert(error.message);
         },
         function () { 
         //OnComplete handler
          }
       );

    The code always errors with this message.

    Error : 404: Not Found: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>IIS 8.0 Detailed Error - 404.0 - Not Found</title>

    I am at a loss as to what the cause could be!

    thanks.


    Maz






    • Edited by MazP Friday, October 17, 2014 3:25 PM
    Friday, October 17, 2014 3:22 PM

Answers

  • If accessing via https the error occurs

    when accessing by http no error occurs


    Maz

    • Marked as answer by MazP Wednesday, October 29, 2014 10:24 AM
    Wednesday, October 29, 2014 10:24 AM