C# HttpWebResponse for xml

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span><span lang="EN-US" style="background:white; color:black; font-family:"Arial","sans-serif" <span style="font-size:small Hello<span lang="EN-US" style="background:white; color:black; font-family:"Arial","sans-serif" <br/>
<span style="font-size:small <br/>
<span style="font-size:small <span lang="EN" style="color:black; font-family:"Arial","sans-serif" <span title="Estou a extrair os resultados através de um webservice utilzando o seguinte código if someone<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" can help<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" me<span style="font-family:Calibri .
<span><span lang="EN-US" style="background:white; color:black; font-family:"Arial","sans-serif" I am extracting the results via a webservice directory to use the following code<span lang="EN-US" style="color:#2b91af; font-family:Consolas; font-size:9.5pt
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="color:#2b91af; font-family:Consolas; font-size:9.5pt
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="color:#2b91af; font-family:Consolas; font-size:9.5pt HttpWebRequest<span lang="EN-US" style="font-family:Consolas; font-size:9.5pt request =
<span style="color:#2b91af WebRequest.Create(webService1) <span style="color:blue
as <span style="color:#2b91af HttpWebRequest;
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="
<span style="color:blue using (<span style="color:#2b91af HttpWebResponse response = request.GetResponse()
<span style="color:blue as <span style="color:#2b91af HttpWebResponse)
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="
{
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="
<span style="color:#2b91af StreamReader reader = <span style="color:blue
new <span style="color:#2b91af StreamReader(response.GetResponseStream());
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="

<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="
file.WriteLine(reader.ReadToEnd());
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="
<span style="color:#2b91af Console.WriteLine(cont);<span style="

<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="font-family:Consolas; font-size:9.5pt <span style="
<span style="font-family:Consolas; font-size:9.5pt }
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 10pt <span style="font-family:Calibri; font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span style="font-size:small <span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" the results<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" extracted<span style="font-family:Calibri in
<span lang="EN-US" style="font-family:Consolas; font-size:9.5pt reader.ReadToEnd
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" <span style="font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 0pt; line-height:normal <span lang="EN-US" style="color:blue; font-family:"Times New Roman","serif"; font-size:12pt <?xml version="1.0"?>
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 10pt <span style="line-height:115%; font-family:"Times New Roman","serif"; font-size:12pt http://services.sapo.pt/GIS/GetLocationByZipCode?zipCode=4480655 <span style="color:blue <<span style="color:#990000 GetLocationByZipCodeResponse<span style="color:blue
<span style="color:red xmlns<span style="color:blue =" <span style="color:red http://services.sapo.pt/Metadata/GIS <span style="color:blue http://services.sapo.pt/GIS/GetLocationByZipCode?zipCode=4480655 <span style="color:blue <<span style="color:#990000 GetLocationByZipCodeResult<span style="color:blue > <<span style="color:#990000 CountryId>PT<span style="color:blue </<span style="color:#990000 CountryId<span style="color:blue ><<span style="color:#990000 CountryName>Portugal<span style="color:blue </<span style="color:#990000 CountryName<span style="color:blue ><<span style="color:#990000 DistrictId>13<span style="color:blue </<span style="color:#990000 DistrictId<span style="color:blue ><<span style="color:#990000 DistrictName>Porto<span style="color:blue </<span style="color:#990000 DistrictName<span style="color:blue ><<span style="color:#990000 MunicipalityId>1316<span style="color:blue </<span style="color:#990000 MunicipalityId<span style="color:blue ><<span style="color:#990000 MunicipalityName>Vila
do Conde<span style="color:blue </<span style="color:#990000 MunicipalityName<span style="color:blue ><<span style="color:#990000 ParishId>131628<span style="color:blue </<span style="color:#990000 ParishId<span style="color:blue ><<span style="color:#990000 ParishName>Vila
do Conde<span style="color:blue </<span style="color:#990000 ParishName<span style="color:blue ><<span style="color:#990000 Latitude>41.35503<span style="color:blue </<span style="color:#990000 Latitude<span style="color:blue ><<span style="color:#990000 Longitude>-8.751406<span style="color:blue </<span style="color:#990000 Longitude<span style="color:blue ></<span style="color:#990000 GetLocationByZipCodeResult<span style="color:blue ></<span style="color:#990000 GetLocationByZipCodeResponse<span style="color:blue >
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 10pt <span style="color:blue; line-height:115%; font-family:"Times New Roman","serif"; font-size:12pt
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 10pt <span style="font-size:small <span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" The idea<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" is to record<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" some of the<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" elements to<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" a<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif"
<span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" text file<span style="font-family:Calibri .<span lang="EN" style="color:black; font-family:"Arial","sans-serif" <br/>
<span style="font-size:small <span><span title="Clique para obter traduções alternativas The problem is<span>
<span>that I am not<span> <span>able to<span> <span>split the<span>
<span>file reading.<br/>
<span><span title="Clique para obter traduções alternativas Is there any way<span>
<span>to save<span> <span>the file<span> <span>elements same this:
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 10pt <span><span lang="EN" style="color:black; font-family:"Arial","sans-serif" <span style="font-size:small
<span style="font-family:Times New Roman; font-size:small
<p style="margin:0cm 0cm 10pt <span style="color:#990000; line-height:115%; font-family:"Times New Roman","serif"; font-size:12pt |MunicipalityName<span style="line-height:115%; font-family:"Times New Roman","serif"; font-size:12pt =Vila do Conde<span style="color:blue <span style="
| <span style="color:#990000 Latitude=41.35503<span style="color:blue |
<span style="color:#990000 Longitude8.751406<span style="color:blue |
<span style="font-family:Times New Roman; font-size:small

View the full article
 
Back
Top