Created
May 17, 2022 15:16
-
-
Save lordgape/bd1963f3ec8266a0c22ff6bf0f6ceb9f to your computer and use it in GitHub Desktop.
This file contains 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 Formatter = require("./formatter"); | |
const ApiClient = require("./api-client"); // Any API Client implementation. Can be axios | |
const Parser = require("./parser"); | |
const url = `http://www.dneonline.com/calculator.asmx`; | |
module.exports = class Remote { | |
static async multipleTwoOperands(operandA, operandB) { | |
try { | |
let payload = { | |
Multiply: { | |
intA: operandA, | |
intB: operandB, | |
}, | |
}; | |
const headers = { | |
headers: { | |
"Content-Type": "text/xml; charset=utf-8", | |
SOAPAction: "http://tempuri.org/Multiply", | |
}, | |
}; | |
let args = Formatter.convertJsonToSoapRequest(payload); | |
let remoteResponse = await ApiClient.post(url, args, headers); | |
remoteResponse = await Parser.convertXMLToJSON(remoteResponse); | |
console.log(remoteResponse); | |
} catch (err) { | |
throw new Error( | |
`Oops something went wrong. Please try again later ${JSON.stringify( | |
err | |
)}` | |
); | |
} | |
} | |
}; |
Anytime 😎
…On Tue, Oct 11, 2022 at 2:58 PM Samuel Munyi ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
I got it to work. Thanks man
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/bd1963f3ec8266a0c22ff6bf0f6ceb9f#gistcomment-4331462>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUQ2PXJ5WPZ2YMVMHAIMJDWCVW7BANCNFSM6AAAAAAQ26523E>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got it to work using axios instead. Thanks man