I have a basic WCF client service in the form below. The first time it is called, it returns the correct data from the remote server. However the data changes frequently. On subsequent calls, it returns the same data that it did on the first call. So, Excel appears to return cached data.
If I run the same WCF procedure from Fiddler or a browser, it seems to always return current/refreshed data (so I think the issue is in Excel, not the server).
How can I force Excel VBA to "refresh" the call instead of getting the data from cache?
Note: this will be distributed to a variety of end users, so I cannot make client config changes.
Public Function CallWCF() As String
Dim HttpReq As Object
Set HttpReq = CreateObject("MSXML2.XMLHTTP")
HttpReq.Open "GET", "http://ws.mydomain.com/Rest.svc/getmydata"
Call HttpReq.Send
Do While HttpReq.readyState <> 4
DoEvents
Loop
Dim resp As String
resp = HttpReq.ResponseText
CallWCF = resp
Set HttpReq = Nothing
End Function