www.webdeveloper.com
Results 1 to 9 of 9

Thread: SOAP call in Javascript to secure WSDL and database

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    6

    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.

    Many thanks, in advance.

  2. #2
    Join Date
    May 2010
    Posts
    6
    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!);
      }

  3. #3
    Join Date
    May 2010
    Posts
    6
    ~bump~

  4. #4
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    I'm not sure either. What framework is it?

  5. #5
    Join Date
    May 2010
    Posts
    6
    The google apps script framework (webapp).

    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.
    Last edited by jqwm8558; 05-24-2010 at 02:55 PM.

  6. #6
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    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:

    http://code.google.com/apis/spreadsh...Authenticating

    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

    Is that at all helpful?

  7. #7
    Join Date
    May 2010
    Posts
    6
    This is indeed very helpful.

    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:

    If for a google app, the code is:

    Code:
    https://www.google.com/accounts/ClientLogin
    Authorization: GoogleLogin auth=yourAuthValue
    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.

  8. #8
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    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.

  9. #9
    Join Date
    May 2010
    Posts
    6
    Quote Originally Posted by svidgen View Post
    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!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles