Created
August 2, 2023 16:26
-
-
Save jojosati/e1d5b68f6eefec8473e9d254518ed156 to your computer and use it in GitHub Desktop.
VAT Service WSDL rd.go.th
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const soap = require("soap"); | |
// reference - https://www.rd.go.th/42535.html | |
const url = "https://rdws.rd.go.th/jsonRD/vatserviceRD3.asmx?wsdl" | |
const wsdl_options = {timeout: 1 * 60 * 1000} | |
const method = "Service" | |
const args = { | |
username: "anonymous", | |
password: "anonymous", | |
TIN: "<ANY-TAXID>", // <== replace with valid taxid | |
}; | |
const ts = Date.now() | |
soap.createClient(url, {wsdl_options}, (err, client) => { | |
if (err) { | |
console.error(err); | |
} else { | |
client[method](args, function(err, result) { | |
console.log(method) | |
if (err) { | |
console.error(err); | |
} else { | |
const r = result[method + 'Result'] | |
console.log(r.$value || JSON.stringify(r)); | |
} | |
console.log(`\n-- consume ${(Date.now() - ts)/1000} secs.\n`) | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment