Reading XML datastream
This question was asked some time ago but went mostly unanswered.
Any ideas would be appreciated:
I am sending the information from a form to a vendor site. There's s hidden fields on the form that is loaded with the well-formed xml when the submit button is clicked. This is then passed to a vendor web site to get a quote. Their system reads this xml from the hidden field (via request.form) and passes pure xml code as the result (with a response.write). There is no other way to communicate with their system except to use their form handler since among other hidden fields are mandatory default fields that rae used to login etc.
My question is this ... how can I capture this XML returned from the form handler so that I can reformat it properly for display?. The returned XML shows up in my browser window but I can't seem to find a way to get to it.
When I use their url directly as the form handler (action=their url) I get the returned XML displayed in my browser ... If I try to replace their form handler with my own (see below)I get a blank page.
ANy help would be greatly appreciated.
I tried using setting the form action to an asp page. Within this asp page I grab all of the for elements and use the MSXML2.ServerXMLHTTP to send the request but it does not seem to be working. I get expected statement errors:
Public Function SentRequest() As Boolean
Dim oHTTPS As MSXML2.ServerXMLHTTP50
Set oHTTPS = New MSXML2.ServerXMLHTTP50
SentRequest = False
Dim sFormData As String
Dim Result As String
sFormData = Space(0)
sFormData = sFormData & "requestid=1122"
sFormData = sFormData & "&"
sFormData = sFormData & "originzip=" & "46750"
sFormData = sFormData & "&"
sFormData = sFormData & "destzip=" & "63303"
sFormData = sFormData & "&"
sFormData = sFormData & "ltldd=" & "S"
sFormData = sFormData & "&"
sFormData = sFormData & "payment=" & "P"
Dim SubmitURL As String
SubmitURL = Space(0)
SubmitURL = SubmitURL "https://www.myyellow.com/dynamic/services/servlet"
SubmitURL = SubmitURL & "?CONTROLLER=com.yell.ec.inter.yfsratequote.ht tp."
SubmitURL = SubmitURL & "controller.RateQuoteAPIController"
With oHTTPS
.Open "post", SubmitURL, False
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "Authorization", "Basic yourUserName:yourPassword"
.Send sFormData
Debug.Print .ResponseXML.xml
Debug.Print vbCrLf
Debug.Print .ResponseText
DoEvents
End With
SentRequest = True
If oHTTPS Is Nothing = False Then
Set oHTTPS = Nothing
End If
End Function
|