Skip to content

Instantly share code, notes, and snippets.

@firefoxNX
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save firefoxNX/1876d05b290d662fc7fb to your computer and use it in GitHub Desktop.
Save firefoxNX/1876d05b290d662fc7fb to your computer and use it in GitHub Desktop.
trireme bluebird error
var Promise = require("bluebird");
var rp = require("request-promise");
var xml2js = require("xml2js");
var xml2jsP = Promise.promisifyAll(require("xml2js"));
var xml2jsOptions = {
explicitArray: false,
valueProcessors: [xml2js.processors.parseNumbers, xml2js.processors.parseBooleans]
}
var serviceOptions = {
url: "http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=AAPL",
method: "GET"
};
var firstResponse = rp(serviceOptions);
firstResponse.then(function (response1) {
var parseString = xml2jsP.parseStringAsync;
parseString(response1, xml2jsOptions).then(function (result1) {
"use strict";
console.log("Response from First Service = ", result1);
var secondServiceOptions = {
url: "http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=MSFT",
method: "GET"
}
var secondServiceResponse = rp(secondServiceOptions);
secondServiceResponse.then(function (response2) {
var parseString = xml2jsP.parseStringAsync;
parseString(response2, xml2jsOptions).then(function (result2) {
console.log("Response from Second Service = ", result2);
}).catch(function(error) {
console.log("Error = " + error.stack);
});
}).catch(function(error) {
console.log("Error = " + error.stack);
});
}).catch(function(error) {
console.log("Error = " + error.stack);
});
}).catch(function(error) {
console.log("Error = " + error.stack);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment