|
-
Getting XML response back to client from ASP using XMTHTTP
Hi,
I am working on my first cXML implementation and have a question. I have
setup a test VB program to send a request to my ASP page. Seems like I can
get the xml sent to the ASP, as I can return it immediately and my VB program
has the correct response.xml. Here's the code from my VB program:
Set oHTTP = New MSXML2.XMLHTTP30
Set fso = CreateObject("scripting.filesystemobject")
Set file = fso.OpenTextFile("c:\request.xml")
'Read in xml from file
Do While Not file.AtEndOfStream
xmlRequest = xmlRequest & file.readline
Loop
file.Close
Set file = Nothing
Set fso = Nothing
Set xmlDOM = New MSXML2.DOMDocument
'Load xml into dom
xmlDOM.loadXML xmlRequest
oHTTP.open "POST", "http://drancour/cxml/punchoutrequest.asp", False
oHTTP.setRequestHeader "Content-Type", "text/xml"
oHTTP.send xmlDOM.xml
Now, when on the serverside ASP page, I have to receive this xml, grab a
couple of nodes (username and password fields). Then evaluate those and return
cXML 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's
responseBody or responseText to get the xml from my web page. I would like
to populate the responseXML property from the page so that it can be loaded
into a dom on the client side once it is received. Here is the ASP code:
set xmlDOM = server.createobject("msxml2.domdocument")
xmlDOM.async = false
xmlDOM.load(request)
'Evaluate the login info....
'Assume login is OK, this would be xml to be returned to client
xmlReturn = "<?xml version=""1.0"" encoding=""UTF-8"" ?>" & _
"<!DOCTYPE cXML (View Source for full doctype...)>" & _
"<cXML payloadID=""456778199@cxml.workchairs.com"" 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 xmlReturn
Response.ContentType = "text/xml"
response.binarywrite xmldom.xml
response.end
Again, this only results in being able to grab the responseText property
of the XMLHTTP object on the client side. What do I do in the ASP to get
the xml to be available to the client in the responseXML property of the
XMLHTTP object??
Thanks in advance!!
David Rancour
Web Developer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks