I'm having issue when i try to send data to Web api which gives an exception HRESULT E_FAIL has been returned from a call to a COM component
System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClasse.b__d(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass1.b__0(Object sendState)
at response HttpResponseMessage response = await client.GetAsync(String.Format(url, Isexist, jsontalleyHeader.ToString(), jsontalleydetail.ToString()));
Wp8 method
public async Task<string> POSTtalleyDetails(bool Isexist, int count)
{
string val = "";
if ((Isexist == false))//first time Load started--need headerNo
{
try
{
using (HttpClient client = new HttpClient())
{
var valjsontalleyHeader = listRtnTalleySheetHeader;
var jsontalleyHeader = Newtonsoft.Json.JsonConvert.SerializeObject(valjsontalleyHeader);
var valtalleydetail = listRtnTalleySheetDetail;
var jsontalleydetail = Newtonsoft.Json.JsonConvert.SerializeObject(valtalleydetail);
client.BaseAddress = new Uri("http://service:Port");
var url = "api/config/InsertTalleydetail?Isexist={0}&talleyheaderlist={1}&talleydetails={2}";
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client.GetAsync(String.Format(url, Isexist, jsontalleyHeader.ToString(), jsontalleydetail.ToString()));
if (response.IsSuccessStatusCode)
{
val = "Ok";
}
else
{
val = "No";
}
}
return val;
}
catch (Exception ex)
{
ex.ToString(); return val = "No";
}
//
}
}
where jsontalleydetail will be
[{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"39.0D39.053000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:53.7504239+05:30","_ConfirmedHatti":7,"_HattiId":1,"_HattiQty":5,"_HattiWeight":0},{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"40.0D40.053000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:53.8672939+05:30","_ConfirmedHatti":7,"_HattiId":2,"_HattiQty":1,"_HattiWeight":0},{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"41.0D41.054000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:54.0238698+05:30","_ConfirmedHatti":7,"_HattiId":3,"_HattiQty":2,"_HattiWeight":0},{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"42.0D42.054000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:54.1564773+05:30","_ConfirmedHatti":7,"_HattiId":4,"_HattiQty":5,"_HattiWeight":0},{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"43.0D43.054000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:54.2542986+05:30","_ConfirmedHatti":7,"_HattiId":5,"_HattiQty":2,"_HattiWeight":0},{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"44.0D44.054000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:54.3582527+05:30","_ConfirmedHatti":7,"_HattiId":6,"_HattiQty":1,"_HattiWeight":0},{"_Isedited":true,"_CreatedBy":"tc1","_visitID":"VISIT0001783","_Remark":"","_Syncable":true,"_ID":"VISIT0001783","_ItemName":"Aeroplane (M) Flour 50Kg","_TalleySheetDetailNo":"45.0D45.054000","_TalleySheetHeaderNo":"T2H1.033000","_ItemMasterId":33,"_WareHouseId":2,"_ManufacturedDate":"2018-09-25T00:00:00+05:30","_LoadingTypeId":7,"_LoadingDate":"2018-09-25T16:51:54.4742785+05:30","_ConfirmedHatti":7,"_HattiId":7,"_HattiQty":2,"_HattiWeight":0}]
and jsontalleyHeader will be
[{"_Remark":"","_TsStartTime":"2018-09-25T16:51:54.4742785+05:30","_TsEndDatetime":"0001-01-01T00:00:00","_VisitID":"VISIT0001783","_Approxweight":18.0,"_WHId":2,"_TalleySheetHeaderNo":"T2H1.033000","_Isedited":false,"_CreatedBy":null,"_visitID":null,"_Syncable":false,"_ID":null,"_ItemName":null,"_TalleySheetDetailNo":null,"_ItemMasterId":0,"_WareHouseId":0,"_ManufacturedDate":"0001-01-01T00:00:00","_LoadingTypeId":null,"_LoadingDate":"0001-01-01T00:00:00","_ConfirmedHatti":null,"_HattiId":null,"_HattiQty":null,"_HattiWeight":0}]
my web api method is
[HttpPost]
public HttpResponseMessage InsertTalleydetail([FromBody]List<clsTalleySheetHeader> talleyheaderlist, List<clsTalleySheetDetail>talleydetails)
{
return todoService.InsertTalleydetail(talleyheaderlist, talleydetails);
//base.BuildSuccessResult(HttpStatusCode.OK, StartTimeDetails);
}
I beleive this is because due to the data Load, because its work fine with 2 to 3 jsontalleydetail .
if could someone could advise me with regard to this , it will be a big help.
I was answered to similar question https://stackoverflow.com/questions/52202989/json-value-doesnt-assign-to-the-list-httppost