'How can I make my request asynchronously without importing a new file
I am trying to perform a SOAP call but sometimes the response is thousands of record. I don't want Excel frozen while it is processing the responses but every example I've seen require importing a separate file with the async callback. Is there a way I can do this without the extra file?
Public Function SendPost(currentTableAltIden As String, altIdentifiers() As String, Optional aSync As Boolean = True)
Dim t As XMLHTTP60
Dim r As MSXML2.DOMDocument60
Dim nodeList As IXMLDOMNodeList
Dim i As Integer
Dim listLengthControl As Integer
Dim listCounter As Integer
Dim xmlHelper As AsyncHelper
i = 0
Set t = Transport
Set xmlHelper = New AsyncHelper
xmlHelper.init t
t.Open "POST", EndPointUrl, aSync
t.send Text
Set r = New MSXML2.DOMDocument60
r.aSync = False
r.validateOnParse = False
r.SetProperty "SelectionNamespaces", " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"
r.LoadXML t.responseText
Set nodeList = r.SelectNodes("//result//" & currentTableAltIden)
listLengthControl = nodeList.Length
While listCounter <> listLengthControl
For i = LBound(altIdentifiers) To UBound(altIdentifiers)
Debug.Print r.SelectNodes("//result//" & currentTableAltIden & "//" & altIdentifiers(i))(listCounter).Text
WorkWebServiceTemp.Cells(TableDataRowNum + listCounter, i + 1).value = r.SelectNodes("//result//" & currentTableAltIden & "//" & altIdentifiers(i))(listCounter).Text
Next i
listCounter = listCounter + 1
Wend
End Function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
