Hi,
I am trying to create a module in access VBA which sends XML to a web address. The module I have created seems to be contecting to web address however I keep getting an error saying I am not authorised even through i am sending the username and password. I have been told I need the XML needs to be "Base64 encoded and appended to an 'Authorization: Basic' HTTP header" however I am not sure what this means, I have not used Base64 before. Can anyone tell me what it is and how I can use it in the module i have created below?
Thank you
Jessica
I am trying to create a module in access VBA which sends XML to a web address. The module I have created seems to be contecting to web address however I keep getting an error saying I am not authorised even through i am sending the username and password. I have been told I need the XML needs to be "Base64 encoded and appended to an 'Authorization: Basic' HTTP header" however I am not sure what this means, I have not used Base64 before. Can anyone tell me what it is and how I can use it in the module i have created below?
Code:
Dim oWeb As MSXML2.XMLHTTP60 'Object from Microsoft XML v 5.0
Dim bStatus As Boolean
Dim wMsg As String
Dim wResult As String
Dim wPosi As Integer
Dim wMaxWait As Integer
Dim wError As String
Dim WB_SERVICE_URL As String
On Error GoTo Proc_ERROR
bStatus = False
WEB_SERVICE_URL = "https://test.test.com/v1.0/messagedispatcher"
'Finish building the XML message
wMsg = "<?xml version=""1.0"" encoding=""utf-8""?>"
wMsg = wMsg & "<Messages><accountreference>EX0266361</accountreference>"
wMsg = wMsg & "<message><to>" & number & "</to>"
wMsg = wMsg & "<body" & City & "</body></message></messages>"
Set myDom = New MSXML2.DOMDocument60
myDom.LoadXml (wMsg)
'Set up to post to our localhost server
Set oWeb = New MSXML2.ServerXMLHTTP60
APIUser = "user1"
ApiKey = "password1"
oWeb.Open "Post", WEB_SERVICE_URL, False, APIUser, ApiKey
oWeb.setRequestHeader "Authorization", "application/xml"
oWeb.send (myDom.XML)
Thank you
Jessica