Last active
August 29, 2015 14:26
-
-
Save firefoxNX/1876d05b290d662fc7fb to your computer and use it in GitHub Desktop.
trireme bluebird error
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
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