1 Replies - 621 Views - Last Post: 21 July 2011 - 06:03 AM

#1 kuu  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 25-November 10

While creating a web service

Posted 20 July 2011 - 10:50 PM

Hi Everbody!

I'm trying to do a Web service to get to current information about weather from the google api link.
( such as : http://www.google.co...eather=istanbul,turkey&@hl=tr )
My purpose is send a parameter (city name) to the web service. And get the xml codes (informations) which is the related with entered city.

I did a research and find that the "best way to get xml codes is using system.xml.linq ". Is that true?
Or are there a different easy way to solve my problem?
And am I return in my function to an xdocument,xnodes etc. or just a string is enough?

Actually some usefull links are better for me

Is This A Good Question/Topic? 0
  • +

Replies To: While creating a web service

#2 kuu  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 25-November 10

Re: While creating a web service

Posted 21 July 2011 - 06:03 AM

  
          HttpWebRequest GoogleRequest;
            HttpWebResponse GoogleResponse = null;
            XmlDocument GoogleXMLdoc = null;
            try
            {
                GoogleRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com/ig/api?weather=" + string.Format(location) + ",turkey&@hl=tr");
                GoogleResponse = (HttpWebResponse)GoogleRequest.GetResponse();
                GoogleXMLdoc = new XmlDocument();
                GoogleXMLdoc.Load(GoogleResponse.GetResponseStream());

                XmlNode root = GoogleXMLdoc.DocumentElement;

                XmlNodeList nodeList1 = root.SelectNodes("weather/forecast_information");




I think I can get inside of the api , but now I want to get just xml codes for my web service.
like in xmlnodelist , I want to take conditions and the inner ones , one by one.
How can I write this xml codes into my web service page?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1