WinHttp.WinHttpRequest and POST.....why not work??

F

Francis

I have the following codes in an asp file. This page can receive the XML string send from client.


==================================================
Dim objReceive
Set objReceive = Server.CreateObject("Microsoft.XMLDOM")
objReceive.async=false

On Error Resume Next
objReceive.load(Request)

if objReceive.xml <> "" then
Dim objWinHttp
Dim strHTML

Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5")
'Set objWinHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objWinHttp.Open "POST", "http://localhost/bank/Trx.asp", false
objWinHttp.Send objReceive.xml

Response.Write( "Status: " & objWinHttp.Status & " " & objWinHttp.StatusText)
strHTML = objWinHttp.ResponseText
Set objWinHttp = Nothing

else
Response.Write( "You have reached a secure site." )
end if
===================================================

objReceive.xml ===> contains the XML string from client
After receiving the XML string, the string need to be sent to another page, http://localhost/bank/Trx.asp.

objWinHttp.Open "POST", "http://localhost/bank/Trx.asp", false


But I cannot get the XML string in the Trx.asp, anything wrong with my code?
The 3rd parametere should I use false or true?

It's a simple code, but I still cannot figure out what is wrong. Pls comment. Thanks a lot.
 
P

Patrice

I would start by removing "On Error Resume Next" to avoid hiding a possible
runtime error. Do you have an error now when running this code ?

The doc is at :
http://msdn.microsoft.com/library/d...y/en-us/winhttp/http/iwinhttprequest_open.asp

Patrice

--

Francis said:
I have the following codes in an asp file. This page can receive the XML string send from client.


==================================================
Dim objReceive
Set objReceive = Server.CreateObject("Microsoft.XMLDOM")
objReceive.async=false

On Error Resume Next
objReceive.load(Request)

if objReceive.xml <> "" then
Dim objWinHttp
Dim strHTML

Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5")
'Set objWinHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objWinHttp.Open "POST", "http://localhost/bank/Trx.asp", false
objWinHttp.Send objReceive.xml

Response.Write( "Status: " & objWinHttp.Status & " " & objWinHttp.StatusText)
strHTML = objWinHttp.ResponseText
Set objWinHttp = Nothing

else
Response.Write( "You have reached a secure site." )
end if
===================================================

objReceive.xml ===> contains the XML string from client
After receiving the XML string, the string need to be sent to another
page, http://localhost/bank/Trx.asp.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top