XHR을 기억하나요, 아니면 XML HTTP 요청이라고해야하나요? :)
Dim xhr As Object
On Error Resume Next
Set xhr = CreateObject("MSXML2.XMLHTTP")
If Err.Number <> 0 Then
Set xhr = CreateObject("MSXML.XMLHTTPRequest")
Application.StatusBar = "Error 0, has occured while creating a MSXML.XMLHTTPRequest object"
End If
If xhr Is Nothing Then
Application.StatusBar = "For some reason it wasn't possible to make a MSXML2.XMLHTTP object"
Exit Function
End If
'consuming the web service.
xhr.Open "POST", "/webservice/url/goes/here", False
xhr.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xhr.send "post parameters can be sent here format: paramname=paramvalue¶mname2=paramvalue2"
If xhr.Status = 200 Then
'creating the XmlDocument to load the received data.
Dim xDoc As MSXML2.DOMDocument60
Set xDoc = CreateObject("Msxml2.DOMDocument.6.0")
xDoc.setProperty "ProhibitDTD", False
xDoc.setProperty "ResolveExternals", True
'loading the data into the in-memory xml document.
xDoc.validateOnParse = True
xDoc.async = False
xDoc.LoadXML xhr.responseText
Application.StatusBar = False
'xDoc now holds your web service returned data
End If
위의 코드에 연결하는 데 사용할 수 있습니다 여기에
는 Oracle 데이터베이스에서 데이터를 반환하는 웹 서비스를 호출하는 사용자를 인증하는 나는 내 프로젝트를 작성한 예입니다 웹 서비스. 이 링크
http://www.mcpher.com/Home/excelquirks/snippets/basicauth에는 기본 인증을 얻는 방법에 대한 자세한 내용이 있습니다. 이 길을 따라 당신을 도와줍니다
희망,
감사합니다.
[Excel 2010 인증을 사용하여 웹 API를 사용하는 방법] (http://stackoverflow.com/q/18119393/456814)의 중복. –