Hi guys, i want to consume WEB API from Dynamics CRM plugin, but returning "503: Server Unavailable"
using (MemoryStream serializeAssignmentWO = new MemoryStream()) { AssignmentWO std = new AssignmentWO(); std.AssignmentWONo = "123457"; std.AssignmentDate = "2021-06-08"; std.CustAcct = "10000514"; std.Address = "Karawaci"; std.TapValue = "Test"; std.Longitude = 0; std.Latitude = 0; std.CableDropPortNo = 0; std.FixTemp = "Test"; DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(AssignmentWO)); WebRequest request = WebRequest.Create("http://bmjkt-000037:9000/crmapi/api/RequestWONoise"); request.Method = "POST"; request.ContentType = "application/json"; request.ContentLength = 0; serializer.WriteObject(serializeAssignmentWO, std); StreamReader sr = new StreamReader(serializeAssignmentWO); string ser_result = sr.ReadToEnd(); throw new InvalidPluginExecutionException("Result: " request.GetResponse()); } public class AssignmentWO { [DataMember] public string AssignmentWONo { get; set; } [DataMember] public string AssignmentDate { get; set; } [DataMember] public string CustAcct { get; set; } [DataMember] public string Address { get; set; } [DataMember] public string TapValue { get; set; } [DataMember] public int Longitude { get; set; } [DataMember] public int Latitude { get; set; } [DataMember] public int CableDropPortNo { get; set; } [DataMember] public string FixTemp { get; set; } }
If i test using Fiddler, its returning: success
Hello, I recommend you to see this link and review it with what you have done, I hope this help:
+ docs.microsoft.com/.../how-to-send-data-using-the-webrequest-class
Thanks!
Community Support Team - Esteban
If this Post helps, then please consider Accept as solution to help the other members find it more quickly.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156