473,757 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:Envelo pe
xmlns:xsi=\"htt p://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"htt p://www.w3.org/2001/XMLSchema\"
xmlns:soap12=\" http://www.w3.org/2003/05/soap-envelope\"<soap 12:Body>
<serviceMetod xmlns=\"http://server:8080/WebService.asmx \"<date>some
date</date<headline>s ome headline</headline<news>s ome news</news>
<author>some author</author</serviceMetod</soap12:Body>
</soap12:Envelope >";

WebRequest wReq =
WebRequest.Crea te("http://server:8080/WebService.asmx ");
HttpWebRequest httpReq = (HttpWebRequest )wReq;

httpReq.Method = "POST";
httpReq.Content Length = soap.Length;
httpReq.Content Type = "applicatio n/soap+xml;charse t=utf-8";
httpReq.Headers .add("SOAPActio n http://someuri.net/serviceMethod") ;
Stream sendStream = httpReq.GetRequ estStream();
StreamWriter strmWrtr = new StreamWriter(se ndStream);
strmWrtr.Write( soap);
strmWrtr.Close( );

string sResult;
try
{
//next line will produce the error
WebResponse wResp = httpReq.GetResp onse();
Stream respStrm = wResp.GetRespon seStream();
StreamReader strmRdr = new StreamReader(re spStrm);
sResult = strmRdr.ReadToE nd();
Console.WriteLi ne(sResult);
}
catch (Exception Ex)
{
sResult = "Web Request returned error: " + Ex.Message;
Console.WriteLi ne(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 8205
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:Envelo pe
xmlns:xsi=\"htt p://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"htt p://www.w3.org/2001/XMLSchema\"
xmlns:soap12=\" http://www.w3.org/2003/05/soap-envelope\"<soap 12:Body>
<serviceMetod xmlns=\"http://server:8080/WebService.asmx \"<date>some
date</date<headline>s ome headline</headline<news>s ome news</news>
<author>some author</author</serviceMetod</soap12:Body>
</soap12:Envelope >";

WebRequest wReq =
WebRequest.Crea te("http://server:8080/WebService.asmx ");
HttpWebRequest httpReq = (HttpWebRequest )wReq;

httpReq.Method = "POST";
httpReq.Content Length = soap.Length;
httpReq.Content Type = "applicatio n/soap+xml;charse t=utf-8";
httpReq.Headers .add("SOAPActio n http://someuri.net/serviceMethod") ;
Stream sendStream = httpReq.GetRequ estStream();
StreamWriter strmWrtr = new StreamWriter(se ndStream);
strmWrtr.Write( soap);
strmWrtr.Close( );

string sResult;
try
{
//next line will produce the error
WebResponse wResp = httpReq.GetResp onse();
Stream respStrm = wResp.GetRespon seStream();
StreamReader strmRdr = new StreamReader(re spStrm);
sResult = strmRdr.ReadToE nd();
Console.WriteLi ne(sResult);
}
catch (Exception Ex)
{
sResult = "Web Request returned error: " + Ex.Message;
Console.WriteLi ne(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
3018
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 Advanced server. IIS5.0 Database: Oracle (Using ADODB to connect to the Database) App server running on the same machine (COM+)
5
6580
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 Environment" with this message: "Error while trying to run project: Unable to start debugging on the web server. Server-side error occurred on sending debug HTTP request. Make sure the server is operating correctly. Verify there are no...
1
2982
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 the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'. --------------------------- OK Help ---------------------------
1
4540
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 to for this problem short of reinstalling the local developer XP OS/IIS 5.1 ? I have tried everything else listed in various threads. I think my mistake was thinking the installation for v/st 2003 was going to upgrade my V/Studio.net 2001, ( I...
1
2865
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 V/Studio 2003. Was running V/Studio classic 6/Asp parallel with V/Studio 2002/aspx. Anyone have any new solutions or urls' to point me to for this problem short of reinstalling the local developer setup consisting of Win XP OS/IIS 5.1 along with FP...
1
1206
by: phranque | last post by:
I am trying to create a webservice on VS.NET 2003 and I get this error. What gives?
2
4123
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 online for answers, but to no avail. Any suggestions from anyone who has had this experience? Now I'm a beginner in this art. I'm trying to learn how to implement WSs for a small distributed application. Nothing critical. Most Thankful. . . Al
0
1791
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 of Python 2.4: Framework build of 2.4.1, Fink build of 2.4.2, Fink build of vtkPython 2.4.2. Same crash from each.
2
7257
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; HttpWebResponse httpResp = null; httpReq = (HttpWebRequest)WebRequest.Create(url);
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.