Re: Error on web service: "Server returned internal error 500"
- From: "imonline" <nisdes@xxxxxxxxx>
- Date: 15 Dec 2006 21:37:50 -0800
Hi,
Why dont you use microsoft soap toolkit for intercepting the
soap messages and find out the exact error.
I hope this resolves your problem.
thanks,
Nis
Tito Meinrath wrote:
Hi,
I'm really going mad about this! Currently I'm designing a student
course on web services. Because I want them to understand what's really
going on when web services correspond with each other (or other
consumers) via SOAP, I want to generate SOAP-messages in XML manually
and send it via POST-method to the hosting server.
But whenever I try to use HttpWebRequest-Class to get a response from a
webservice, I get an "Internal Server Error (500)" on response. I've
searched the web for similar problems (and indeed I've found a lot),
but I could not find a working solution.
Here is my source code:
******************************************************************
String soap = "<soap12:Envelope
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"> <soap12:Body>
<serviceMetod xmlns=\"http://server:8080/WebService.asmx\"> <date>some
date</date> <headline>some headline</headline> <news>some news</news>
<author>some author</author> </serviceMetod> </soap12:Body>
</soap12:Envelope>";
WebRequest wReq =
WebRequest.Create("http://server:8080/WebService.asmx");
HttpWebRequest httpReq = (HttpWebRequest)wReq;
httpReq.Method = "POST";
httpReq.ContentLength = soap.Length;
httpReq.ContentType = "application/soap+xml;charset=utf-8";
httpReq.Headers.add("SOAPAction http://someuri.net/serviceMethod");
Stream sendStream = httpReq.GetRequestStream();
StreamWriter strmWrtr = new StreamWriter(sendStream);
strmWrtr.Write(soap);
strmWrtr.Close();
string sResult;
try
{
//next line will produce the error
WebResponse wResp = httpReq.GetResponse();
Stream respStrm = wResp.GetResponseStream();
StreamReader strmRdr = new StreamReader(respStrm);
sResult = strmRdr.ReadToEnd();
Console.WriteLine(sResult);
}
catch (Exception Ex)
{
sResult = "Web Request returned error: " + Ex.Message;
Console.WriteLine(sResult);
}
******************************************************************
I'm using IIS 6 and VS 2005. Maybe this is an IIS-configuration
problem?
Any help would be really appreciated!
Thanx in advance
Tito
.
- References:
- Error on web service: "Server returned internal error 500"
- From: Tito Meinrath
- Error on web service: "Server returned internal error 500"
- Prev by Date: Error on web service: "Server returned internal error 500"
- Next by Date: Re: exposing method sending bitmap
- Previous by thread: Error on web service: "Server returned internal error 500"
- Next by thread: Re: exposing method sending bitmap
- Index(es):
Relevant Pages
|