web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer Service forum

Accessing external web service in Dynamics 365 online

(0) ShareShare
ReportReport
Posted on by

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:
I have the same question (0)
  • Suggested answer
    Michel van den Brink Profile Picture
    4,697 on at

    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");
    }
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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
    Mahmoud Hakim Profile Picture
    17,887 on at

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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans