request and responses

S

shank

The below partial code gets UPS rates. It's based on a request and response.
I can get the request to write to screen with "response.write
server.HTMLEncode(strXML)".

How can I get the response to write to screen so I can see what's being
returned by UPS?
thanks

<%
strXML is established above here.....
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","https://www.ups.com/ups.app/xml/Rate?",false
xmlhttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = =
'this code writes UPS XML Request and Response to screen
' response.write server.HTMLEncode(strXML)
' response.End()
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = =
xmlhttp.send strXML
xml_response = xmlhttp.responseText
Set mydoc=Server.CreateObject("Microsoft.xmlDOM")
mydoc.loadxml( xml_response )
Set Response_NodeList = mydoc.documentElement.selectNodes("Response")
ups_result =
Response_NodeList.Item(0).selectSingleNode("ResponseStatusCode").Text
......
%>
 
B

Bob Barrows [MVP]

shank said:
The below partial code gets UPS rates. It's based on a request and
response. I can get the request to write to screen with
"response.write server.HTMLEncode(strXML)".

How can I get the response to write to screen so I can see what's
being returned by UPS?
thanks

<%
<snip>
Response.ContentType="text/xml"
myDoc.Save Response
 
M

Martin Honnen

shank wrote:

How can I get the response to write to screen so I can see what's being
returned by UPS?
thanks

<%
strXML is established above here.....
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","https://www.ups.com/ups.app/xml/Rate?",false
xmlhttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = =
'this code writes UPS XML Request and Response to screen
' response.write server.HTMLEncode(strXML)
' response.End()
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = =
xmlhttp.send strXML

Response.ContentType = "application/xml"
xmlhttp.responseXML.save Response

is one way to send the XML directly to the browser (where then for
instance IE and Mozilla will apply XSL to show the XML pretty printed).
 
S

shank

Bob Barrows said:
<snip>
Response.ContentType="text/xml"
myDoc.Save Response

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
====================
I tried both examples given as below and get the same results. I get parse
errors for not having closed tags like </link>, </br>, etc. Is there a way
to "only" get the response from UPS to the screen and not the whole page?
thanks!
<%
strXML is established above here.....
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","https://www.ups.com/ups.app/xml/Rate?",false
xmlhttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"

'Response.ContentType="text/xml"
'myDoc.Save Response

Response.ContentType = "application/xml"
xmlhttp.responseText.save Response

xmlhttp.send strXML
......
%>
 
B

Bob Barrows [MVP]

shank said:
====================
I tried both examples given as below and get the same results. I get
parse errors for not having closed tags like </link>, </br>, etc. Is
there a way to "only" get the response from UPS to the screen and not
the whole page? thanks!
<%
strXML is established above here.....
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","https://www.ups.com/ups.app/xml/Rate?",false
xmlhttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"

'Response.ContentType="text/xml"
'myDoc.Save Response

Response.ContentType = "application/xml"
xmlhttp.responseText.save Response

xmlhttp.send strXML
.....
%>

You have to call send BEFORE attempting to write the result to response.

Have you looked at the example at aspfaq?
http://www.aspfaq.com/show.asp?id=2173
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top