Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

Accessing external web service in Dynamics 365 online

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I was trying to access a web service which I need to get some data from, however due to Dynamics 365 Online is a sandbox environment , I was not able to access the web service in the plugin, I have to access the data & use in in the plugin so using JSONP is impractical in my case.

Or do you guys have any clues on how to proceed? Thanks.

Categories:
  • Suggested answer
    Mahmoud Hakim Profile Picture
    Mahmoud Hakim 17,887 on at
    RE: Accessing external web service in Dynamics 365 online

    you can check this links

    social.microsoft.com/.../how-to-call-external-web-services-from-dynamics-crm

    community.dynamics.com/.../240447

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Accessing external web service in Dynamics 365 online

    The below is a sample of accessing web data from a sandboxed plugin on the msdn site:

    msdn.microsoft.com/.../gg509030.aspx

    Hope this helps.

  • Suggested answer
    Michel van den Brink Profile Picture
    Michel van den Brink 4,697 on at
    RE: Accessing external web service in Dynamics 365 online

    Hello Kentan,

    Accessing an external webservice from a Dynamics 365 (CRM) Customer Engagement plug-in is possible.
    Due to the sandbox limitations there's a few rules you need to follow but, outside of that everything works just like in other .NET code.

    You mentioned you were not able to get the data, did you get an Exception?
    If so, what was the Exception? And do you have a snippet of your code?

    ----

    The general rules for trying to access an external webservice from a plug-in:

    1. Only the HTTP and HTTPS protocols are allowed.
    2. Access to localhost (loopback) is not permitted.
    3. IP addresses cannot be used. You must use a named web address that requires DNS name resolution.
    4. You can not read or use: System.Net.CredentialCache
    5. Recommended to use System.Net.WebClient to interact with web
    6. Serializes are available:
      1. System.Runtime.Serialization.DataContractSerializer
      2. System.Runtime.Serialization.Json.DataContractJsonSerializer

    An example would be:

    using (WebClient wc = new WebClient())
    {
        wc.Headers.Add("Authorization: Bearer ey8927eg534gnm89u24xcm4856454c5t....."); // If you need auth
        string output = wc.DownloadString("api.examplewebservice.com/customers");
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans