Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > HttpWebRequest Not Working?

Reply
Thread Tools

HttpWebRequest Not Working?

 
 
JS
Guest
Posts: n/a
 
      09-18-2006
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.GetEnco ding("utf-8"));
string sOutput =response_stream.ReadToEnd();

Response.Write(sOutput);

response_stream.Close();

====

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HttpWebRequest / CookieContainer - not deleting cookies. macro ASP .Net 4 03-29-2006 07:48 PM
HttpWebRequest POST result is not the same as POST via ServerXMLHT =?Utf-8?B?RGF2ZSBCcm93bg==?= ASP .Net 1 11-10-2005 07:49 PM
HttpWebRequest.GetResponse on POST returns 405 method not allowed GlennLanier ASP .Net 2 06-10-2005 12:15 PM
httpWebRequest not sending client Certificate =?Utf-8?B?TWFydmlu?= ASP .Net 1 08-08-2004 07:28 AM
HttpWebRequest is not posting Jeff Washburn ASP .Net 0 07-28-2003 09:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57