Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Calling Rest Api From Plugin

$
0
0

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


Viewing all articles
Browse latest Browse all 55831

Trending Articles