/**
* Responds to any HTTP request that can provide a "cep" field in the body.
*
* @param {!Object} req Cloud Function request context.
* @param {!Object} res Cloud Function response context.
*/
exports.helloWorld = function helloWorld(req, res) {
console.log("Using parameter: " + req.body.cep);
var soap = require('soap');
var url = 'http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx?WSDL';
var args = {
nCdServico: "40010",
sCepOrigem: "94035330",
sCepDestino: req.body.cep
};
soap.createClient(url, function(err, client) {
client.CalcPrazo(args, function(err, resoap) {
res.status(200).send('Success: ' + JSON.stringify(resoap));
});
});
}
Last active
July 12, 2021 21:13
-
-
Save diegopacheco/53eabd7f5fab1bf365e67fdcf176cb02 to your computer and use it in GitHub Desktop.
How to Call WS Soap from Google Cloud Functions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment