473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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

Dec 15 '06 #1
1 8176
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
Dec 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sam | last post by:
Guys facing a strange problem any clue would really rescue me.. i am using a ASP application with following things Server : Intel Xeon (TM) CPU 2GHz, 2GB RAM, 136GB HDD OS : Windows 2000...
5
by: Bruce Schechter | last post by:
I just started to develop an ASP.NET application in vs.net 2003 . But each time I try to execute the application (which is basically empty so far), I get a dialog box titled "Microsoft Development...
1
by: Greg Burns | last post by:
--------------------------- Microsoft Development Environment --------------------------- The Web server reported the following error when attempting to create or open the Web project located at...
1
by: gerr | last post by:
Visual studio 2003 "HTTP/1.1 500 Internal Server Error" when trying to create a new Asp.net site with Visual Studio 2003 on localServer/IIS 5.1. Anyone have any new solutions or urls to point me...
1
by: gerr | last post by:
Visual studio 2003 "HTTP/1.1 500 Internal Server Error" when trying to create a new Asp.net site with Visual Studio 2003 on localServer XP Pro/IIS 5.1. Everything worked fine prior to installing...
1
by: phranque | last post by:
I am trying to create a webservice on VS.NET 2003 and I get this error. What gives?
2
by: Sosa | last post by:
Greetings, I have XP Pro and installed IIS 5.1. I tried to create a web service through VS.Net 2003 Pro. When I click the Open button, I get the above subject line error message. I've looked...
0
by: David T | last post by:
Has anyone run across this error? When calling any of several visualization routines from FiPy, Python quits with a Bus Error I'm using MacOS X Tiger 10.4.3, and I've tried several builds...
2
by: Andy Chen | last post by:
Hi, When I am using the fowllowing code to open page http://spaces.msn.com/members/mailcall/ .... try{ string url = http://spaces.msn.com/members/mailcall/; HttpWebRequest httpReq = null;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.