Getting an error after sending a request to web server

kmehgjaveg

New Member
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: \[quote\] (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.\[/quote\]Stack Trace:\[code\][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\[/code\]Version Information:
  • Microsoft .NET Framework Version: 2.0.50727.3623;
  • ASP.NET Version: 2.0.50727.5053
this is my code\[code\]Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click Dim s = "" s = s & "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf s = s & "<soap:Envelope xmlns=""http://www.opentravel.org/OTA/2003/05"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:wsse=""http://schemas.xmlsoap.org/ws/2002/12/secext"">" s = s & "<soap:Body>" & vbCrLf s = s & "<OTA_AirLowFareSearchRQ EchoToken=""0"" SequenceNmbr=""0"" TransactionIdentifier=""0"" Version=""1.001"" xmlns=""http://www.opentravel.org/OTA/2003/05"" DirectFlightsOnly=""false"" >" & vbCrLf s = s & "<POS xmlns=""http://www.opentravel.org/OTA/2003/05"">" & vbCrLf s = s & "<Source AgentSine="""" PseudoCityCode=""NPCK"" TerminalID=""1"">" & vbCrLf s = s & "<RequestorID ID=""AFFILIATE""/>" & vbCrLf s = s & "</Source>" & vbCrLf s = s & "<YatraRequests>" & vbCrLf s = s & "<YatraRequest DoNotHitCache=""false"" DoNotCache=""false"" YatraRequestTypeCode=""SMPA"" Description="""" MidOfficeAgentID=""28737"" AffiliateID=""YTFABTRAVEL"" />" & vbCrLf s = s & "</YatraRequests>" & vbCrLf s = s & "</POS>" & vbCrLf s = s & "<OriginDestinationInformation>" & vbCrLf s = s & "<DepartureDateTime WindowAfter=""POD"" WindowBefore=""POD"">" & txtDeparture.Text & "</DepartureDateTime>" & vbCrLf s = s & "<OriginLocation CodeContext=""IATA"" LocationCode=""" & drpFrom.SelectedValue & """>" & drpFrom.SelectedValue & "</OriginLocation>" & vbCrLf s = s & "<DestinationLocation CodeContext=""IATA"" LocationCode=""" & drpTo.SelectedValue & """>" & drpTo.SelectedValue & "</DestinationLocation>" & vbCrLf s = s & "</OriginDestinationInformation>" & vbCrLf s = s & "<TravelerInfoSummary>" & vbCrLf s = s & "<AirTravelerAvail>" & vbCrLf s = s & "<PassengerTypeQuantity Code=""ADT"" FareBasisCode=""T"" Quantity=""" & drAdult.SelectedValue & """/>" & vbCrLf s = s & "<PassengerTypeQuantity Code=""CHD"" FareBasisCode=""T"" Quantity=""" & drpChil.SelectedValue & """/>" & vbCrLf s = s & "<PassengerTypeQuantity Code=""INF"" FareBasisCode=""T"" Quantity=""" & drpInfant.SelectedValue & """/>" & vbCrLf s = s & "</AirTravelerAvail>" & vbCrLf s = s & "</TravelerInfoSummary>" & vbCrLf s = s & "<TravelPreferences>" & vbCrLf s = s & "<CabinPref Cabin=""" & drpClass.SelectedValue & """/>" & vbCrLf s = s & "</TravelPreferences>" & vbCrLf s = s & "</OTA_AirLowFareSearchRQ>" & vbCrLf s = s & "</soap:Body>" & vbCrLf s = s & "</soap:Envelope>" & 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\[/code\]this is my xml that I am sending :\[code\]<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext"><soap:Body><OTA_AirLowFareSearchRQ EchoToken="0" SequenceNmbr="0" TransactionIdentifier="0" Version="1.001" xmlns="http://www.opentravel.org/OTA/2003/05" DirectFlightsOnly="false" ><POS xmlns="http://www.opentravel.org/OTA/2003/05"><Source AgentSine="" PseudoCityCode="NPCK" TerminalID="1"><RequestorID ID="AFFILIATE"/></Source><YatraRequests><YatraRequest DoNotHitCache="false" DoNotCache="false" YatraRequestTypeCode="SMPA" Description="" MidOfficeAgentID="28737" AffiliateID="YTFABTRAVEL" /></YatraRequests></POS><OriginDestinationInformation><DepartureDateTime WindowAfter="POD" WindowBefore="POD">20/02/2013</DepartureDateTime><OriginLocation CodeContext="IATA" LocationCode="BLR">BLR</OriginLocation><DestinationLocation CodeContext="IATA" LocationCode="GOI">GOI</DestinationLocation></OriginDestinationInformation><TravelerInfoSummary><AirTravelerAvail><PassengerTypeQuantity Code="ADT" FareBasisCode="T" Quantity="1"/><PassengerTypeQuantity Code="CHD" FareBasisCode="T" Quantity="2"/><PassengerTypeQuantity Code="INF" FareBasisCode="T" Quantity="0"/></AirTravelerAvail></TravelerInfoSummary><TravelPreferences><CabinPref Cabin="Economy"/></TravelPreferences></OTA_AirLowFareSearchRQ></soap:Body></soap:Envelope>\[/code\]
 
Back
Top