I have the following code to send a POST request to Server.
HttpWebRequest myWebRequest = (HttpWebRequest)HttpWebRequest.Create(uri);
myWebRequest.Method = WebRequestMethods.Http.Post;
myWebRequest.ContentLength = data.Length;
myWebRequest.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(myWebRequest.GetRequestStream());
writer.Write(data);
writer.Close();
The data to be posted is an XML request with nearly 2000 Characters. I read the response as shown below.
this.Response.ContentType = "text/xml";
StreamReader reader = new StreamReader(this.Request.InputStream);
string responseData = reader.ReadToEnd();
The response data that we are obtaining above has only a portion of the actual data send.
Please help me to get the full data.
This worked for me, i think you miss the Encoding… using this i’m sending huge xml to server