Getting an error after sending a request to web server-Collection of common programming errors
Guys I am getting the following error on sending xml based request to a server. Could you help me to understand the stack trace?
The remote server returned an error:
(500) Internal Server Error.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal > > Server Error.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[WebException: The remote server returned an error: (500) Internal Server Error.]
System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) +302
System.Net.WebClient.UploadData(Uri address, String method, Byte[] data) +158
System.Net.WebClient.UploadData(String address, Byte[] data) +34
WebApplication1._Default.btnSearch_Click(Object sender, EventArgs e) in C:\Users\Mubashir\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\Default.aspx.vb:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Version Information:
- Microsoft .NET Framework Version: 2.0.50727.3623;
- ASP.NET Version: 2.0.50727.5053
this is my code
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
Dim s = ""
s = s & "" & vbCrLf
s = s & ""
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & txtDeparture.Text & "" & vbCrLf
s = s & "" & drpFrom.SelectedValue & "" & vbCrLf
s = s & "" & drpTo.SelectedValue & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
s = s & "" & vbCrLf
Dim url = "http://203.189.91.127:9090/services/spm/spm"
Dim doc As New XmlDocument()
doc.LoadXml(s)
Dim req As HttpWebRequest = WebRequest.Create(url)
req.Headers.Add("SOAPAction", "")
req.ContentType = "text/xml;charset=""utf-8"""
req.Accept = "text/xml"
req.Method = "POST"
Dim stm As Stream = req.GetRequestStream()
doc.Save(stm)
stm.Close()
Dim resp As WebResponse = req.GetResponse()
stm = resp.GetResponseStream()
Dim r As StreamReader = New StreamReader(stm)
'process SOAP return doc here. For now, we'll just send the XML out to the browser ...
Response.Write(r.ReadToEnd())
End Sub
this is my xml that I am sending :
20/02/2013
BLR
GOI