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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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