J
JS
Hi All,
I am trying to post an xml document to a java web service but I am
getting an error saying, "The remote server returned an error: (500)
Internal Server Error".
I have tried sending the xml document using Curl and it is working
fine.
I am assuming that my Request might be in the wrong format:
How can I print the HttpWebRequest to see the output of this request??
What does SOAPAction mean???
request.Headers.Add("SOAPAction", "?");
All help is appreciated.
Thanks,
JS
Below is my code:
====
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("test.xml"));
HttpWebRequest request = (HttpWebRequest) WebRequest.Create("address to
webservice");
//request.Headers.Add("SOAPAction", "?");
request.Method = "POST";
request.ContentType = "text/xml; charset=utf-8";
//request.Timeout = 30 * 1000;
Stream request_stream = request.GetRequestStream();
xmlDoc.Save(request_stream);
request_stream.Close();
WebResponse response = request.GetResponse();
Stream r_stream = response.GetResponseStream();
StreamReader response_stream =
new StreamReader(r_stream,System.Text.Encoding.GetEncoding("utf-8"));
string sOutput =response_stream.ReadToEnd();
Response.Write(sOutput);
response_stream.Close();
====
I am trying to post an xml document to a java web service but I am
getting an error saying, "The remote server returned an error: (500)
Internal Server Error".
I have tried sending the xml document using Curl and it is working
fine.
I am assuming that my Request might be in the wrong format:
How can I print the HttpWebRequest to see the output of this request??
What does SOAPAction mean???
request.Headers.Add("SOAPAction", "?");
All help is appreciated.
Thanks,
JS
Below is my code:
====
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("test.xml"));
HttpWebRequest request = (HttpWebRequest) WebRequest.Create("address to
webservice");
//request.Headers.Add("SOAPAction", "?");
request.Method = "POST";
request.ContentType = "text/xml; charset=utf-8";
//request.Timeout = 30 * 1000;
Stream request_stream = request.GetRequestStream();
xmlDoc.Save(request_stream);
request_stream.Close();
WebResponse response = request.GetResponse();
Stream r_stream = response.GetResponseStream();
StreamReader response_stream =
new StreamReader(r_stream,System.Text.Encoding.GetEncoding("utf-8"));
string sOutput =response_stream.ReadToEnd();
Response.Write(sOutput);
response_stream.Close();
====