locked
CRM 2011: Calling external REST web service from crm form through jQuery RRS feed

  • 问题

  • Hi,

    I was trying to call a external REST WCF service from crm form onLoad event to validate the city using the following source code, the exact code worked well in a testing aspx page, however when I put it into crm web resource, it doesn't work, didn't even hit the service code when debugging, by the way I can run jQuery to access dynamics crm 2011 REST endpoint i.e. create new account record with no problem in the same place from crm form event. Any help will be greatly appreciated!

     

     

    try

    {

    $.ajax({ 

           type: 'GET',

           contentType: 'application/json; charset=utf-8',

           datatype: 'json',

           url: 'http://dev/Service.svc/pcres/miami',

           processdata: false,

           success: function (msg) {

                    alert('success');

           },

           error: function(err) {

                    alert('error');

           }

       });

    }

    catch(e)

    {

          alert( 'catch' + e.description);

    }

     

     



    2011年7月28日 15:36

答案

  • Thanks Daemon! It makes sense, afterall, when accessing CRM outlook client throught OWA, same security consideration should apply.

    I found a workaround already so you can external web service through form event on CRM client side, hopefully next dynamics crm release can provide better OOB solution for this.

    Frank

    • 已标记为答案 .frank 2011年9月30日 15:11
    2011年8月8日 18:45

全部回复

  • I recommend Fiddler (or some equivalent http sniffer) to trace what actually happens when the  - it almost always helps debug issues related to SOAP, AJAX, WCF, etc - especially if it works for CRM REST calls, but fails for your custom REST service.

    http://www.fiddler2.com/fiddler2/

    Ken

    2011年8月3日 5:17
  • Accessing external WCF Service is a acrossing domain access via json, for the security consideration, it is forbidden by browser.


    daemon lin
    2011年8月3日 5:55
  • Thanks Daemon, what about CRM outlook client, is it forbidden too?

    Frank

    2011年8月5日 15:14
  • hi, frank, i think it is forbidden too
    daemon lin
    2011年8月6日 12:57
  • Thanks Daemon! It makes sense, afterall, when accessing CRM outlook client throught OWA, same security consideration should apply.

    I found a workaround already so you can external web service through form event on CRM client side, hopefully next dynamics crm release can provide better OOB solution for this.

    Frank

    • 已标记为答案 .frank 2011年9月30日 15:11
    2011年8月8日 18:45
  • Hi Frank

    I have very similar requirement in which I have to call external REST endpoint from CRM web resource.

    Can u please share the work around!!

    Regards

    Karan

    2012年2月29日 10:29
  • what was your work around? the only way i got it to work is creating a costum security level for IE, whay is not so cool.

    Cheers

    2012年7月11日 20:58