Re: Error on web service: "Server returned internal error 500"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Error on web service: "Server returned internal error 500"
    ... going on when web services correspond with each other (or other ... I get an "Internal Server Error " on response. ... Stream sendStream = httpReq.GetRequestStream; ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: SOAP, WSIT, Im LOST, sort of...
    ... Now I've been asked to evaluate "WEB Services" ... I use SOAP to communicate with several other companies that I don't know ... protocol (the Simple Object Access Protocol; ... On the VMS system this mail is taken care ...
    (comp.os.vms)
  • Getting soap configuration to work
    ... ' Define a SOAP Extension that traces the SOAP request and SOAP response ... Private oldStream As Stream ... Public Overrides Function ChainStreamAs ... ByVal attribute As SoapExtensionAttribute) As Object ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: about SOAP
    ... I just wonder why must web service use this SOAP protocol when web site ... With Web Services, you have a web server making a request to another web ... server for some web method to ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: SOAP on z/OS?
    ... I don't know SOAP. ... standards within the Web Services family of standards. ... SOAP for CICS. ... Message Broker is a very fine way to provide Web Services interfaces to all ...
    (bit.listserv.ibm-main)