Also, it looks like you're using a POST request to do a GET query. That
may be returning an error instead of event objects, so that could be
getting in your way. Take a look at the actual URL and try pasting it in
a browser. Also, you can try printing out the returned XML as plaintext
to help in your debugging, to make sure the problem isn't before your
query call. If you're using XPath (not sure, i'm not a .Net guy), you
may want to try /rsp/event. The advantage of building a REST-like API is
that we usually print out helpful error messages on the way.
stewsterl wrote:
>
>
> I'm currently working on an ASP.NET site that needs to use the
> Upcoming API.
>
> I have the following code to get the returned XML:
>
> Dim url As String = "http://upcoming.yahooapis.com/services/rest/?
> <http://upcoming.yahooapis.com/services/rest/?>
> method=venue.search&location=Troy,3;MI&api_key=<Your Key>"
>
> Dim RequestXMLstring As String = "<?xml version='1.0'?
> ><element1>Some Value</element1>"
> Dim XmlResult As New System.Xml.XmlDocument
> Dim anXMLhttpObject As Object
> anXMLhttpObject = Server.CreateObject("MSXML2.ServerXMLHTTP")
>
> Try
> anXMLhttpObject.open("POST", url, False)
> Catch
> Response.Write("Connection cannot be established. Please
> try again later.")
> End Try
>
> anXMLhttpObject.setRequestHeader("Content-
> Type", "application/x-www-form-urlencoded")
>
> anXMLhttpObject.setRequestHeader("Content-Length", Len
> (RequestXMLstring))
>
> anXMLhttpObject.send(RequestXMLstring)
>
> Dim strResult As String = anXMLhttpObject.responseText
>
> XmlResult.LoadXml(strResult)
>
> '***************************************
>
> Dim bodyAttrib As System.Xml.XmlNodeList =
> XmlResult.SelectNodes("rsp/")
>
> For Each attr As XmlNode In bodyAttrib
> Dim name As XmlAttribute = DirectCast
> (attr.Attributes.GetNamedItem("name"), XmlAttribute)
> Dim val As XmlAttribute = DirectCast
> (attr.Attributes.GetNamedItem("description"), XmlAttribute)
> If name IsNot Nothing AndAlso val IsNot Nothing Then
> TextBox1.Text = name.Value & val.Value
> End If
> Next
>
> I get the results just fine. I'm having a little trouble parsing the
> xml here -->XmlResult.SelectNodes("rsp/")
> I've tried: XmlResult.SelectNodes("rsp/event")
> No luck.. Anyone have any ideas?
>
> Thank you in advance..
>
>
.