none
Classic ASP and Azure API

    Question

  • Hello,

    I really need help. Before 1st Aug I used to used this code which displayed BING Image results in XML format, it worked a treat.

    URL = "http://api.bing.net/xml.aspx?AppId={my ID went here}&Query=BMW&Sources=Image&Version=2.0&Market=en-us&Adult=Strict"
    Set objXML = Server.CreateObject("MSXML2.DOMDOCUMENT.6.0")
    objXML.setProperty "ServerHTTPRequest", True

    objXML.async =  False
    objXML.Load(URL)

    If objXML.parseError.errorCode <> 0  Then
        Response.Write(objXML.parseError.reason)
        Response.Write(objXML.parseError.errorCode)
    End If
    set imageURL = objXML.getElementsByTagName("mms:Thumbnail")

    Now can someone please let me know what I need to do to get it working with the Azure Market place.

    Thank you

    F

    Thursday, September 06, 2012 7:49 PM

Answers

  • Have you tried creating a request generating raw requests through a tool like fiddler? then you can also use it to capture requests outgoing from your server to DataMarket and see what the difference is between the two.
    Tuesday, September 25, 2012 6:36 PM
  • I am not familiar with ASP. But you can use the regular way to access the new service. Just issue HTTP requests. We simply changed the URI, the authentication scheme (you can use standard basic authentication), and the response format. It is still a REST service. So you existing ASP skill can be used. However, it is highly recommended to upgrade to ASP.NET.
    Wednesday, September 26, 2012 3:48 AM

All replies

  • Hello,

    The Service is REST based API, so you can still use it as a simple http request with basic authentication (using account key). However, since the API has moved to Windows Azure market place, you can use BingSearchContainer.cs to get the result from Bing Search API. See Integrate Bing Search API into ASP.Net application .

    Thursday, September 06, 2012 10:34 PM
  • Thank you for the reply. I've not moved to .NET, so I really need help with the code for classic ASP. I am stuck with getting this going and would really need example of code that I can use.

    I have tried this:

    <%@language=Jscript%>
    <%
       MyNewKey = "my key goes ere"
       var objSrvHTTP;
       objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0");
       objSrvHTTP.open ("GET","https://api.datamarket.azure.com/Bing/Search/v1/Image?Query=%27mr2%27&Adult=%27Strict%27&$top=50&$format=Atom",false,MyNewKey);
       objSrvHTTP.send ();
       Response.ContentType = "text/xml";
       Response.Write (objSrvHTTP.responseXML.xml);
    %>

    I have also tried:

    <%

        MyNewKey = "my key goes here"                
        searchURL= "https://api.datamarket.azure.com/Bing/Search/v1/Image?Query=%27mr2%27&Adult=%27Strict%27&$top=50&$format=Atom"
        Set xmlObj = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
        xmlObj.open "GET", searchURL, false
        xmlObj.setRequestHeader "Authorization" ,"Basic " &   & MyNewKey
        xmlObj.send
       Response.Write (xmlObj.responseXML.xml)

    %>

    even

    <%

    Dim objSrvHTTP: Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
    http.open "GET","https://api.datamarket.azure.com/Bing/Search/v1/Image?Query=xbox&Adult=%27Strict%27&$top=50", False, "", MYkey
    http.send
    Response.ContentType = "text/xml"
    http.responseXML.save Response

    %>


    • Edited by Fais K Friday, September 07, 2012 4:20 PM
    Friday, September 07, 2012 8:45 AM
  • Have you tried creating a request generating raw requests through a tool like fiddler? then you can also use it to capture requests outgoing from your server to DataMarket and see what the difference is between the two.
    Tuesday, September 25, 2012 6:36 PM
  • I am not familiar with ASP. But you can use the regular way to access the new service. Just issue HTTP requests. We simply changed the URI, the authentication scheme (you can use standard basic authentication), and the response format. It is still a REST service. So you existing ASP skill can be used. However, it is highly recommended to upgrade to ASP.NET.
    Wednesday, September 26, 2012 3:48 AM