SOAP call in Javascript to secure WSDL and database
Is it possible to call a WSDL document behind authentication with an existing SOAP service to pull data from a database behind authentication in Javascript?
I'm new to this, but I'm a very quick learner. Ultimately, I want to insert script into a spreadsheet to aggregate data from a database behind authentication.
I'm working off of this framework, but not sure how to authenticate:
Code:
function getAsObjectBydatabaseID(0113e545fb9f4cf960) {
var wsdl = SoapService.wsdl("https://~here's the wsdl behind authentication~?wsdl");
var xget_Xreport = wsdl.getAsObjectByID();
var param = Xml.element("getAsObjectByID", [
Xml.attribute("xmlns", "http://schemas.xmlsoap.org"),
Xml.element("Xreport", [
Xreport
])
]);
var result = get_report.Xreport(param);
return result.getAsObjectByIDResponse(not entirely sure what to put here!);
}
Ultimately, I'd like to see data print to a spreadsheet cell via a javascript SOAP call. The data and the WSDL are behind authentication, and I'm just not sure how to add my credentials in the script.
Alright. That puts some context on the issue, which is helpful. Though it looks like your script is sitting on top of some other JavaScript framework or library. Or do you have a javascript library provided by Google? I couldn't find one.
In any case, the code you've posted is presumably backed by an XMLHttpRequest object at some level. And that is where you need to work in the authentication:
You'll need to make an initial request containing the user credentials. And then, either through the JavaScript library/framework you're using or attached directly to some XMLHttpRequest object, you'll need to be able to set an HTTP header containing that token.
Though, my suspicion is that you'll need to do this in some server-side language to avoid cross-site scripting issues and other security issues. For that, you'd want to look at one of the server-side packages and push the heavy lifting out of view: http://code.google.com/apis/spreadsh...guide_php.html
For clarity, the data I'm trying to access is not a google app. It has it's own (secure) WSDL and database. So, I want to pull data from there into a google spreadsheet, with script inside the spreadsheet. Essentially, my question is:
Where would I find the language to do this for the application that I want to pull data from? Would I have to request that directly from the developers of the application, or would it be in the WSDL, or is there a standard?
Basically, to access the WSDL, I need to log-in. I need to know how to add the log-in information to my SOAP call. I'm very new to this, but I'm a zippy learner! Thanks for your help.
To log into a 3rd party web service, you need to contact the provider. The WSDL may indicate an obvious place to stuff credentials in requests. But, like the google web services, it may be a matter of grabbing an authentication token and passing it as a header with each request.
So ... If you're authenticating with or through the 3rd party webservice, they ought to have authentication procedures as part of their documentation. If you can't find it, you just have to contact them. There's no universal authentication scheme that applies to all web services.
To log into a 3rd party web service, you need to contact the provider. The WSDL may indicate an obvious place to stuff credentials in requests. But, like the google web services, it may be a matter of grabbing an authentication token and passing it as a header with each request.
So ... If you're authenticating with or through the 3rd party webservice, they ought to have authentication procedures as part of their documentation. If you can't find it, you just have to contact them. There's no universal authentication scheme that applies to all web services.
Thank you! This is precisely what I needed to know. Many thanks!
Bookmarks