Getting XML response back to client from ASP using XMTHTTP

admin

Administrator
Staff member
Hi,I am working on my first cXML implementation and have a question. I havesetup a test VB program to send a request to my ASP page. Seems like I canget the xml sent to the ASP, as I can return it immediately and my VB programhas the correct response.xml. Here's the code from my VB program:Set oHTTP = New MSXML2.XMLHTTP30Set fso = CreateObject("scripting.filesystemobject")Set file = fso.OpenTextFile("c:\request.xml")'Read in xml from fileDo While Not file.AtEndOfStreamxmlRequest = xmlRequest & file.readlineLoopfile.CloseSet file = NothingSet fso = NothingSet xmlDOM = New MSXML2.DOMDocument'Load xml into domxmlDOM.loadXML xmlRequestoHTTP.open "POST", "http://drancour/cxml/punchoutrequest.asp", FalseoHTTP.setRequestHeader "Content-Type", "text/xml"oHTTP.send xmlDOM.xmlNow, when on the serverside ASP page, I have to receive this xml, grab acouple of nodes (username and password fields). Then evaluate those and returncXML indicating whether or not the login credentials are valid. However,if login is successful I seem to be only able to evaluate the oHTTP object'sresponseBody or responseText to get the xml from my web page. I would liketo populate the responseXML property from the page so that it can be loadedinto a dom on the client side once it is received. Here is the ASP code:set xmlDOM = server.createobject("msxml2.domdocument")xmlDOM.async = falsexmlDOM.load(request)'Evaluate the login info....'Assume login is OK, this would be xml to be returned to clientxmlReturn = "<?xml version=""1.0"" encoding=""UTF-8"" ?>" & _"<!DOCTYPE cXML (View Source for full doctype...)>" & _"<cXML payloadID=""[email protected]"" xml:lang=""enUS"" timestamp=""19990312T18:39:0908:00""version=""1.1.009"">" & _"<Response>" & _"<Status code=""200"" text=""OK"" />" & _"<PunchOutSetupResponse>" & _"<StartPage>" & _"<URL>http://premier.workchairs.com/store?23423SDFSDF23</URL>" & _"</StartPage>" & _"</PunchOutSetupResponse>" & _"</Response>" & _"</cXML>"xmldom.loadxml xmlReturnResponse.ContentType = "text/xml"response.binarywrite xmldom.xmlresponse.endAgain, this only results in being able to grab the responseText propertyof the XMLHTTP object on the client side. What do I do in the ASP to getthe xml to be available to the client in the responseXML property of theXMLHTTP object??Thanks in advance!!David RancourWeb Developer
 
Back
Top