| | |
Read XML response from a webservice
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 57
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
Views: 341 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible complex content contenttype control countryselector courier database datagrid datagridview datalist deployment development dgv dialog dropdown dropdownmenu dynamic dynamically edit editing embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv folder form gridview gudi identity iis image javascript languages list maps menu mobile mssql nameisnotdeclared novell opera order problem profile ratings redirect refer registration relationaldatabases response.redirect rows search security select serializesmo.table sessionvariables silverlight smoobjects software sql ssl tracking treeview typeof validatedate validation vb vb.net vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment wizard xsl





