vbscript xml问题

vbscript xml问题,vbscript,web-services,Vbscript,Web Services,我有一个vbscript,它调用用.NET2010编写的web服务。 最后一行有个错误。我想不出来。 这是Web服务: 这不是VBScript问题,而是xpath问题。xmldoc2.documentElement.SelectSingleNodeEleftCarShortTitle将尝试将LeftCarShortTitle元素作为根的子元素来查找……在您的情况下,这将不起作用,因为在此之前有不同的级别,例如 将xpath更新为: //LeftCarShortTitle 这将遍历文档的子体,并

我有一个vbscript,它调用用.NET2010编写的web服务。 最后一行有个错误。我想不出来。 这是Web服务:


这不是VBScript问题,而是xpath问题。xmldoc2.documentElement.SelectSingleNodeEleftCarShortTitle将尝试将LeftCarShortTitle元素作为根的子元素来查找……在您的情况下,这将不起作用,因为在此之前有不同的级别,例如

将xpath更新为:

//LeftCarShortTitle


这将遍历文档的子体,并应找到您要查找的节点。

虽然通常应避免//但如果XML结构已知,则显式路径更可靠。@Anthony,是的,我同意。但是,为了解决这个问题,考虑到XML响应不是很大,我觉得上面的内容就足够了。这似乎是经典的ASP,避免使用MSXML2.XMLHTTP,使用MSXML2.ServerXMLHTTP
   Dim xmlDOC
    Dim bOK
    Dim J
    Dim HTTP
    Dim ImagePathLeftCar, ImagePathRightCar
    Dim CarIDLeft, CarIDRight
    Dim ShortTitleLeftCar, ShortTitleRightCar
    Dim DescriptionLeftCar, DescriptionRightCar 
    Dim PriceLeftCar, PriceRightCar

    Set HTTP = CreateObject("MSXML2.XMLHTTP")
    Set xmlDOC =CreateObject("MSXML.DOMDocument")
    xmlDOC.Async=False

    HTTP.Open "GET","http://www.kollelbaaleibatim.com/services/getinfo.asmx/GetFronpageInfo", false 
    HTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    HTTP.Send()  

    dim xmldoc2   
    set xmldoc2 = Server.CreateObject("Microsoft.XMLDOM")
    xmldoc2.async = False 
    bOK = xmldoc2.load(HTTP.responseXML)

    if Not bOK then
        response.write( "Error loading XML from HTTP")
    end if

    response.write( xmldoc2.documentElement.xml)'Prints a good looking xml
      ShortTitleLeftCar = xmldoc2.documentElement.selectSingleNode("LeftCarShortTitle").text 'ERROR HERE