Hey
Im want to be able to use SOAP calls to call a server and get the information to an excel cell. I have been trying to figure it out via other threads but im stilll just as lost can anyone help with this. Im sure if i can get one working all other requests should be easy.
This is the information provided from the TAB is
'Target
https://api.tab.com.au/tabapi/services/thirdPartyAuthenticate
'Example SOAP Request
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.thirdparty.api.neo.tabcorp.com.au/">
<soapenv:header>
<soapenv:body>
<ser:authenticateaccount>
<apimeta>
<jurisdictionid>1</jurisdictionid>
<requestchannel>5</requestchannel>
<usernamepasswordtoken></usernamepasswordtoken>
</apimeta>
<authrequest>
<accountid>ACCOUNT ID GOES HERE</accountid>
<accountpassword>PASSWORD GOES HERE</accountpassword>
</authrequest>
</ser:authenticateaccount>
</soapenv:body>
</soapenv:header></soapenv:envelope>
My very poor attempt is
Sub TABcall()
Dim xmlHtp As New MSXML2.XMLHTTP
Dim sURL As String
Dim sEnv As String
Dim XMLDOC As New DOMDocument
sURL = "https://api.tab.com.au/tabapi/services/thirdPartyAuthenticate"
sEnv = <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.thirdparty.api.neo.tabcorp.com.au/">"
sEnv = sEnv & "<soapenv:header>"
sEnv = sEnv & " <soapenv:body>"
sEnv = sEnv & " <ser:authenticateaccount>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <apimeta>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <jurisdictionid>1</jurisdictionid>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <requestchannel>5</requestchannel>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " </apimeta>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <authrequest>"
sEnv = sEnv & " <accountid>1212124</accountid>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <accountpassword>password</accountpassword>"
sEnv = sEnv & " </authrequest>"
sEnv = sEnv & " </ser:authenticateaccount>"
sEnv = sEnv & " </soapenv:body>"
sEnv = sEnv & "</soapenv:header></soapenv:envelope>"
With xmlHtp
.Open "POST", sURL, False
.setRequestHeader "Host", ""
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "soapAction", "QueryCSV" ' per the documentation
.send sEnv
XMLDOC.LoadXML .responseText
XMLDOC.Save ActiveWorkbook.Path & "\WebQueryResult2.xml"
End With
MsgBox xmlHtp.statusText
End Sub
Can anyone help with this?
Im want to be able to use SOAP calls to call a server and get the information to an excel cell. I have been trying to figure it out via other threads but im stilll just as lost can anyone help with this. Im sure if i can get one working all other requests should be easy.
This is the information provided from the TAB is
'Target
https://api.tab.com.au/tabapi/services/thirdPartyAuthenticate
'Example SOAP Request
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.thirdparty.api.neo.tabcorp.com.au/">
<soapenv:header>
<soapenv:body>
<ser:authenticateaccount>
<apimeta>
<jurisdictionid>1</jurisdictionid>
<requestchannel>5</requestchannel>
<usernamepasswordtoken></usernamepasswordtoken>
</apimeta>
<authrequest>
<accountid>ACCOUNT ID GOES HERE</accountid>
<accountpassword>PASSWORD GOES HERE</accountpassword>
</authrequest>
</ser:authenticateaccount>
</soapenv:body>
</soapenv:header></soapenv:envelope>
My very poor attempt is
Sub TABcall()
Dim xmlHtp As New MSXML2.XMLHTTP
Dim sURL As String
Dim sEnv As String
Dim XMLDOC As New DOMDocument
sURL = "https://api.tab.com.au/tabapi/services/thirdPartyAuthenticate"
sEnv = <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.thirdparty.api.neo.tabcorp.com.au/">"
sEnv = sEnv & "<soapenv:header>"
sEnv = sEnv & " <soapenv:body>"
sEnv = sEnv & " <ser:authenticateaccount>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <apimeta>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <jurisdictionid>1</jurisdictionid>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <requestchannel>5</requestchannel>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " </apimeta>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <authrequest>"
sEnv = sEnv & " <accountid>1212124</accountid>"
sEnv = sEnv & " <!--Optional:-->"
sEnv = sEnv & " <accountpassword>password</accountpassword>"
sEnv = sEnv & " </authrequest>"
sEnv = sEnv & " </ser:authenticateaccount>"
sEnv = sEnv & " </soapenv:body>"
sEnv = sEnv & "</soapenv:header></soapenv:envelope>"
With xmlHtp
.Open "POST", sURL, False
.setRequestHeader "Host", ""
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "soapAction", "QueryCSV" ' per the documentation
.send sEnv
XMLDOC.LoadXML .responseText
XMLDOC.Save ActiveWorkbook.Path & "\WebQueryResult2.xml"
End With
MsgBox xmlHtp.statusText
End Sub
Can anyone help with this?
Last edited: