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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Calling Rest Api From Plugin

(0) ShareShare
ReportReport
Posted on by

I have created a plugin which get activated when any new connection created.

And in plugin i am calling a REST api to store data in our OLD system.

But when i am calling  like below

bytes = Encoding.UTF8.GetBytes(PayLoad);

  1. using (var client = new WebClient())
  2. {
  3. client.Headers[HttpRequestHeader.Accept] = "application/json";
  4. client.Headers[HttpRequestHeader.ContentType] = "application/json";
  5. client.Encoding = Encoding.UTF8;
  6. var response = client.UploadData(RestUrl, "PUT", bytes);
  7. return Encoding.UTF8.GetString(response);
  8. }

But its not running and when i am debugging it comes on line 7 and when i hit F10 it getting stop and my Plugin Registration Tool also get crashed.

If it don't get crash i can get the exception but due to that i am unable to catch the cause.

Thanks,

Rahul tiwari

*This post is locked for comments

I have the same question (0)
  • MMK Profile Picture
    745 on at

    Came across the same situation what is the solution of this

  • MMK Profile Picture
    745 on at

    I also came across the same situation what is the solution for this

  • prt33k Profile Picture
    6,907 on at

    What is the authentication mechanism for the service?

    Please note :

    Sandboxed plug-ins and custom workflow activities can access the network through the HTTP and HTTPS protocols. This capability provides support for accessing popular web resources like social sites, news feeds, web services, and more. The following web access restrictions apply to this sandbox capability.

    • Only the HTTP and HTTPS protocols are allowed.
    • Access to localhost (loopback) is not permitted.
    • IP addresses cannot be used. You must use a named web address that requires DNS name resolution.
    • Anonymous authentication is supported and recommended. There is no provision for prompting the logged on user for credentials or saving those credentials.

    https://msdn.microsoft.com/en-in/library/gg334752.aspx

    Thanks,

    PS

  • mluce Profile Picture
    306 on at

    Same issue here - did you ever find a solution?

  • mluce Profile Picture
    306 on at

    Actually, if you log to the tracingservice the plugin actually carries on.  Its just the plugin registration tool does not seem to like web service calls like this.  I got around the issue by just being very verbose with the tracing service.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans