| | |
Read XML response from a webservice
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 56
Reputation:
Solved Threads: 1
Hi, I've tried to get the geolocation of the clients IP, with this code:
But I keep getting the error "The underlying connection was closed: An unexpected error occurred on a receive." when executes the GetResponse line.
I tried to get better methods to do the same, but no luck.
The XML returned by the WS (http://freegeoip.appspot.com/xml/200.62.145.200) is something like this:
So I need to parse into a ds or a dt, or something that I could read.
Thanks in advance.
Omar
vb Syntax (Toggle Plain Text)
Dim rssReq As System.Net.WebRequest = _ System.Net.WebRequest.Create("http://freegeoip.appspot.com/xml/" _ & vl_bContadorVisitasBE.vcConVisIP) 'Crear el Proxy Dim px As New System.Net.WebProxy("http://freegeoip.appspot.com/xml/" _ & vl_bContadorVisitasBE.vcConVisIP, True) 'Asignar el Proxy al objeto WebRequest rssReq.Proxy = px 'Establecer el tiempo de vida al objeto WebRequest rssReq.Timeout = 2000 Try 'Obtener el objeto WebResponse Dim rep As System.Net.WebResponse = rssReq.GetResponse() [COLOR="Red"]<-- ERROR[/COLOR] 'Insertar el objeto Response en el objeto XMLTextReader Dim xtr As New System.Xml.XmlTextReader(rep.GetResponseStream()) 'Insertar el objeto Response en el objeto DataSet ds.ReadXml(xtr) Catch ex As Exception End Try
But I keep getting the error "The underlying connection was closed: An unexpected error occurred on a receive." when executes the GetResponse line.
I tried to get better methods to do the same, but no luck.
The XML returned by the WS (http://freegeoip.appspot.com/xml/200.62.145.200) is something like this:
xml Syntax (Toggle Plain Text)
<?xml version="1.0" encoding="UTF-8" ?> <Response> <Status>true</Status> <Ip>200.62.145.200</Ip> <CountryCode>PE</CountryCode> <CountryName>Peru</CountryName> <RegionCode>15</RegionCode> <RegionName>Lima</RegionName> <City>Lima</City> <ZipCode /> <Latitude>-12.05</Latitude> <Longitude>-77.05</Longitude> </Response>
So I need to parse into a ds or a dt, or something that I could read.
Thanks in advance.
Omar
![]() |
Similar Threads
- Include Base64 encoded data into XML (Java)
- Unable to capture XML Response (ColdFusion)
- Read XML File in C/C++ (C++)
- read xml file and display to many text box (C#)
Other Threads in the ASP.NET Forum
- Previous Thread: Viewstate
- Next Thread: ASP.Net Validators Problems
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox click commonfunctions confirmationcodegeneration css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dialog dropdownlist dynamically edit expose feedback fileuploader fill flash form formatdecimal forms formview gridview gudi iframe iis javascript jquery listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers





