On Mon, 28 Apr 2008 08:02:07 +0100, ats@jbex wrote:
Here is the code I am using:
Sub SendPmt()
Dim xmlObj As MSXML2.XMLHTTP26
Dim xmldoc As DOMDocument26
Dim xNode As MSXML2.IXMLDOMNode
Dim Nodes As MSXML2.IXMLDOMNodeList
Dim url As String
Dim responset As String
Dim responsex As String
Dim response As String
Dim sUser As String
Dim sPass As String
Set xmlObj = New MSXML2.XMLHTTP26
Set xmldoc = New DOMDocument26
'set username and password
sUser = "uname"
sPass = "pwd"
'set url
url = "
https://somesite"
'set up the document
xmldoc.async = False
xmldoc.resolveExternals = False
xmldoc.validateOnParse = False
xmldoc.Load xmlPmt 'a document with a .xml extension
'parse for errors
If xmldoc.parseError = 0 Then
MsgBox "Parsed OK"
Else
MsgBox "Not Parsed" & vbCrLf & err.Number & vbCrLf &
err.Description
End If
'post the xml
xmlObj.Open "POST", url, False, sUser, sPass
xmlObj.SetRequestHeader "Content-Type", "text/xml"
xmlObj.Send xmldoc.XML
'get the response text
responset = xmlObj.ResponseText
'and the xml - THIS PART THROWS AN ERROR
responsex = xmlObj.responseXML
'try to load the response - AS RESPONSEXML DOESN'T WORK TRIED IT WITH
RESPONSETEXT INSTEAD
If xmldoc.Load(responset) Then
Set Nodes = xmldoc.ChildNodes
For Each xNode In Nodes
If xNode.nodeName = "lastEvent" Then
response = xNode.Text
End If
Next xNode
Else
response = "Failed to load"
End If
MsgBox response & vbCrLf & responset, vbOKOnly + vbInformation,
gAppname
The code work fine for sending an xml document but fails to load the
response. Am I doing something wrong?
End Sub
--
ats@jbex
Don't believe them
Don't believe them
Question everything you're told
SLF - Suspect Device