SOAP Calls through VBA

Duckmorph

New Member
Joined
Aug 2, 2013
Messages
25
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>accountid</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
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Sorry people i cant get this website to display the information. When i click source mode it shows up and then i save it and its left blank like it is..... Any ideas
 
Upvote 0
What isn't working, unless I've missed something, you haven't explained your problem
 
Upvote 0
Its fine ive sorted the main problem out, my problem was displaying the information, all the soap envelope coding is missing, every time i click save on the thread it disapears. Anyway another day
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,431
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top