I am trying to create an app in which the user enters a zipcode into a text box and the local weather is displayed.
I saw a Feb. 2013 thread which had some code but I can’t seem to get it to work. The thread was located at:
The code was by duanemitchell was as follows:
[code]dim vXML, answerString, newRow as string
dim hsock as new HTTPSocket
vXML = “<?xml version=""1.0"" encoding=""utf-16""?>”
vXML = vXML + “<soap:Envelope xmlns:soap=”“http://schemas.xmlsoap.org/soap/envelope/”" xmlns:xsi="“http://www.w3.org/2001/XMLSchema-instance”" xmlns:xsd="“http://www.w3.org/2001/XMLSchema”">"
vXML = vXML + “soap:Body”
vXML = vXML + “<ns1:GetCityWeatherByZIP xmlns:ns1=”“http://ws.cdyne.com/WeatherWS/”">"
vXML = vXML + “ns1:ZIP”+edfTextEntry.Text+"</ns1:ZIP>"
vXML = vXML + “</ns1:GetCityWeatherByZIP>”
vXML = vXML + “</soap:Body>”
vXML = vXML + “</soap:Envelope>”
// HTTPSocket version
hsock = new HTTPSocket
hsock.yield = false
hsock.SetRequestContent vXML, “text/xml”
Dim x As New XmlDocument(answerString)
// check first node of document:
Dim n As XmlNode = x.FirstChild
// and now walk over all sub nodes, just the data sub nodes which are deep
Dim childNode As XmlNode = n.FirstChild.FirstChild.FirstChild.FirstChild 'data is 4 nodes deep
While childNode <> Nil
If childNode.PreviousSibling <> Nil and childNode.PreviousSibling.Name=“Pressure” then
newRow = childNode.Name + ": " + childNode.FirstChild.Value
childNode = childNode.NextSibling
I created a Window and placed the following controls:
Listbox called lbXMLOutput
Textbox called - txtTextOutput
Textbox called edfTextEntry
I also drag into the project a TCPSocket called TCPSocket1 and changed the Super to: HTTPSocket
I then put the above code in the Load event.
When I run the project I get and error that says that the Compilation Failed. The error also says if the application exists, please make sure that it is not currently running, otherwise make sure that the destination directory is writable
Does anyone see what I am doing wrong or have better code for getting the weather by zip code?
Any help would be greatly appreciated.