Any help would be appreciated.
Dim oXMLHTTP As XMLHTTP ' is msxml6.dll
Dim oDoc As DOMDocument
Dim oList As IXMLDOMNodeList
Dim oElem As IXMLDOMElement
Dim oNode As IXMLDOMNode
Dim strError As String
Dim strEDocPath As String
Dim strEDocFile As String
Const cErrInTUResponse = 65210
Const cErrResourceNotFound = -2146697211
83
86 Set oDoc = New DOMDocument
87 oDoc.async = False
' cbfXML returns a well formed XML document
88 oDoc.loadXML cbfXML()
89 If (oDoc.parseError.ErrorCode <> 0) Then
90 Err.Raise oDoc.parseError.ErrorCode, Me.Name & ".cbfReport",
oDoc.parseError.Reason & "; " & oDoc.parseError.srcText
91 End If
92
' post and get the reply
94 Set oXMLHTTP = New XMLHTTP
95 Call SysCmd(acSysCmdSetStatus, "Connecting...")
96 oXMLHTTP.Open "POST", "https://RemovedForDiscussion", 0
97 Call SysCmd(acSysCmdSetStatus, "Waiting...")
98 oXMLHTTP.Send oDoc
DoEvents
99 If Not oDoc.loadXML(oXMLHTTP.responsexml.xml) Then
100 strError = "An unexpected error occured. LoadXML failed. "
101 Error cErrInTUResponse
102 Else
' check that the document loaded
104 If oDoc.documentElement Is Nothing Or Len(oDoc.xml) = 0 Then
105 strError = "An unexpected error occured. Nothing was
returned. "
106 Error cErrInTUResponse
107 End If
Patrick
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Patrick Jackman
Vancouver, BC
604-874-5774
> 99 If Not oDoc.loadXML(oXMLHTTP.responsexml.xml) Then
> 100 strError = "An unexpected error occured. LoadXML failed. "
> 101 Error cErrInTUResponse
If you already have responseXML then there is no need at all to use
loadXML. Simply check oXMLHTTP.responseXML.parseError.errorCode/reason
to find any errors in the XML you have received.
And I don't know much about VBA and stuff like DoEvents but usually with
MSXML and XMLHTTP you would either make an asynchronous request by
passing True as the third argument of the open method or you would make
a synchronous request by passing False as the third argument. Then, to
process the response in the case of an asynchronous request you set up
an onreadystatechange event handler on the XMLHTTP object. In the case
of a synchronous request the send call block and you can process the
response status after the send call.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
In case it helps, DoEvents is essentially a message loop. If you don't know
what that is then think of it as something that allows pending events to be
processed.
Patrick.
"Martin Honnen" <maho...@yahoo.de> wrote in message
news:eTrVATUz...@TK2MSFTNGP03.phx.gbl...
"Patrick Jackman" <pjac...@wimse.com> wrote in message
news:%23A%23TgiLz...@TK2MSFTNGP03.phx.gbl...
Yes the code is incomplete. There are all sorts of reasons that will could
cause a the HTTP post to fail. On return from a synchronous call to .Send
(which you are doing) the code should test that the oXMLHTTP.Status is 200.
If not then the POST failed in some way. The Status code indicates what
went wrong.
--
Anthony Jones - MVP ASP/ASP.NET