Попытка просто получить файл XML и выложить его содержимое через API на веб-сайт. Это работало в прошлом, и сейчас я пересматриваю его код. Я получаю сообщение об ошибке:
Открытый член 'OpenAsTextStream' для типа 'FileSystemObject' не найден.
Вот весь код:
<%@ Page Title="MAIN" Language="vb" Explicit="true" AspCompat="true" %>
<%
Dim objFSO, objStream, ProductStr, ProdCodestr, ProdPricestr, xml_to_send, x
x = 1
objFSO = Server.CreateObject("Scripting.FileSystemObject")
Dim Filepath
Filepath = Server.MapPath("sample.xml")
objStream = objFSO.OpenAsTextStream(1, -2)
Do Until objStream.AtEndOfStream
' create the Xml that the Msxml2.serverXmlHttp object will send to the Webservice
ProductStr = objStream.readline(x)
ProdCodestr = ProductStr.substr(0, ",")
ProdPricestr = ProductStr.substr(",", )
xml_to_send = "<?xml version=""1.0"" encoding=""utf-8"" ?>"
Xml_to_Send = Xml_to_Send & "<xmldata>"
Xml_to_Send = Xml_to_Send & " <products>"
xml_to_send = xml_to_send & " <ProductCode>" & ProdCodestr & "</ProductCode>"
xml_to_send = xml_to_send & " <ProductPrice>" & ProdPricestr & "</ProductPrice>"
xml_to_send = xml_to_send & " </products>"
xml_to_send = xml_to_send & "</xmldata>"
x = x + 1
Loop
objStream.Close()
objStream = Nothing
objFSO = Nothing
' create the Msxml2.serverXmlHttp object needed to post the Xml to the WebService
Dim oXMLHttp
oXMLHttp = Server.CreateObject("Msxml2.serverXmlHttp")
oXMLHttp.open("POST", "http://www.mywebsite.com/net/WebService.aspx?Login=my@email.com&EncryptedPassword=xxx&Import=Update", False)
oXMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
oXMLHttp.setRequestHeader("Content-Action", "xmldata")
oXMLHttp.setTimeouts(100000, 100000, 600000, 9999999)
Server.ScriptTimeout = 10800
' Send the Xml
oXMLHttp.Send()
' Receive the Xml
Dim Xml_Returned
Xml_Returned = oXMLHttp.responseText
' Validate the Xml
Dim xmlDoc
xmlDoc = Server.CreateObject("Msxml2.DOMDocument")
xmlDoc.loadXML(Xml_Returned)
If (Len(xmlDoc.text) = 0) Then
Xml_Returned = ("<B>ERROR in Response xml:<BR>ERROR DETAILS:</B><BR><HR><BR>") & Xml_Returned
End If
' Display the Xml on the browser
Response.Write(Xml_Returned)
' clean up
xml_to_send = Nothing
oXMLHttp = Nothing
Xml_Returned = Nothing
xmlDoc = Nothing
%>