I am trying to make a post call with very large argument size. But the call is not going through.
Issue: When size of parameter is large call is not going through.But in case of small parameter everything is fine that means API is working. I tried to research about POST
call but couldn't make it work.
What i Did I made a sample api project and tried it to test via postman and project too.
Postman call
This is working fine as expected.
If someone is going to point out rquest.ContentLength = 0;
. This is because param is getting appended to url only. I don't intend it to get appended but
i don't know how to do it and googled too. For small length this is working but say if string length goes to 3000 it fails.
API Call Initiator
UriBuilder uriBuilder = new UriBuilder(restURL);
var query = HttpUtility.ParseQueryString(uriBuilder.Query);
query["json"] = new JavaScriptSerializer().Serialize(reportParameterDictionary);
uriBuilder.Query = query.ToString();
restURL = uriBuilder.ToString();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(restURL);
request.Method = "Post";
request.ContentType = "application/json";
rquest.ContentLength = 0;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseData = reader.ReadToEnd();
response.Close();
dynamic obj = JsonConvert.DeserializeObject(responseData);
if (obj != null)
{
printresult = obj.Success;
}
}
Receiving End
[Route("PrintReport")]
public IHttpActionResult PrintReport(string json)