In my application i write insert, delete function in C#. I need to check those functions in Restapi. Whenever i check it says error and in function parameters are always null. My c# code is,
[HttpPost]
public HttpResponseMessage InsertOrganizationDetails(Organization[] Organization)
{
try
{
return new HttpResponseMessage()
{
Content = new StringContent(string.Concat(crudorganization.InsertOrganizationDetails(Organization)), Encoding.UTF8, "application/json")
};
}
catch (Exception ex)
{
RevshopWebAPI.Global.LogFile.Log.WriteLog("Exception in method - GetOrganizationDetails ", ex.ToString(), RevshopWebAPI.Global.LogType.Error);
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
}
The following is inside crudorganization class,
public object InsertOrganizationDetails(Organization[] Organization)
{
try
{
DataSet ds = new DataSet();
for (int i = 0; i < Organization.Length; i++)
{
object[] objParamValue = { Organization[i].Type, Organization[i].Parent, Organization[i].Company, Organization[i].Address_1, Organization[i].Address_2, Organization[i].City, Organization[i].State, Organization[i].Zip, Organization[i].Country, Organization[i].Phone, Organization[i].Fax };
ds = sqlHelper.GetDataset(connStr, Procedures.InsertOrganizationDetails, ProcedureParams.InsertOrganizationDetailsParameter, objParamValue);
}
return jsonUtility.serializetoJSON("1");
}
catch (Exception ex)
{
LogFile.Log.WriteLog(ex.ToString(), ex.Message);
throw ex;
}
}
Whenever i tried in API and select post option then click send button i get the following error message,
Abort / timeout
The request has been aborted manually or because of the conection timeout. There were no response from the server but the connection wasn't closed.
You can adjust timeout in settings.
Try to:
add "Connection: close" header which should be used by the server to close the connection after it finish generating response
Please, check if:
all required services (like www) are up and running on server
method is correct
port number is correct
url is correct
all required headers and/or payload has been added to the request
Example
Sometimes it may happen when you use http protocol instead of https. Also it may happen when you use different URL (port / protocol) and the server is not configured properly.
Please help me.
What I have tried:
I am not getting what ever i tried.