Skip to content

Instantly share code, notes, and snippets.

@lookingcloudy
Created March 1, 2014 12:13
Show Gist options
  • Save lookingcloudy/9288957 to your computer and use it in GitHub Desktop.
Save lookingcloudy/9288957 to your computer and use it in GitHub Desktop.
Q Problem
Here is the library client now:
innotas.createClient()
.then(function (client) {
innotas.login(client, user, pass)
})
.then(function (client) {
console.log("calling projects", client);
innotas.getProjects(client);
})
;
This is what is returned:
Soap client created <-- called from "createClient"
calling projects undefined <-- this is from the above code to indicate the 3rd step in the process.
<-- this should not be called yet...until after "Authenticated" appears.
Authenticated: d05b3bf6-0896-4a2c-b787-2b6baa4a6da7 <-- This is from step 2 and is the return from the login() function
The login return looks like this now:
return q.ninvoke(client, 'login', { username: user, password: password })
.then(function (result) {
console.log("Authenticated: ", result[0]['return']);
self.innotasSessionId = result[0]['return'];
return client;
}, function (err) {
console.log("Error: ", err.body);
})
getProjects() looks like this:
// CALL WEB SERVICE
return q.ninvoke(client, 'findEntity', req)
.then(function success (result) {
console.log('retrieved list of projects ', result);
}, function fail (err) {
console.log('err getting projects ', err.body);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment