Web Services

From Open Source Software Research
Jump to: navigation, search

Web Services programmatic access to SRDA was provided on a experimental basis … but is not currently support -- Greg Madey

Seems to be down (see main page).--Heitmann 18:10, 4 July 2010 (EDT)

Web Services have recently been deployed for access by our users. They are in a preliminary stage and we were hoping to use SOAP with attachments, but a lack of documentation and examples leaves us with a serviceable substitute. Here is a Perl snippet which will submit a query, and then if the query is successful, downloads the file (naming it the current unix timestamp in seconds with a .txt extension). Submitting the query was not the trouble with our test SOAP code. Transferring the file was the issue. So this piece of code uses SOAP for query submission and then uses wget to retrieve the file. The get_schema() method is where the SQL statement is placed. The parameters are select, from, and where, followed by the record separator. As with the web form, the where parameter can be empty. If this is the case for your query, use a blank string ('' or "" in perl).

Warning: This script will not work for users that have account passwords that contain the '@' symbol (and possibly other special characters)

#!/usr/bin/perl -w

use strict;
use SOAP::Lite;

my $user = 'user_name_goes_here';  # replace this with your username
my $passwd = 'password_goes_here'; # replace this with your password
my $local_file_name = `date +%s`;
chomp $local_file_name;
$local_file_name .= ".txt";
my $result;
my $message;

my $soap = SOAP::Lite
  -> uri ('https://zerlot.cse.nd.edu/Query_SOAP')
  -> proxy ('https://'.$user.':'.$passwd.'@zerlot.cse.nd.edu/cgi-bin/query_soap.pl', timeout => 3600)
  -> get_schema('*', 'sf0208.groups', '', ':');

$message = $soap->paramsout;
$result = $soap->result;
if ($result == 0) {
  # Success
  system "wget --http-user=$user --http-passwd=$passwd --no-check-certificate https://zerlot.cse.nd.edu/qresult/$user/$user.txt -O $local_file_name"; 
} else {
  print "Result is $result, message is $message\n";

Question: Is this tool still working? I have just tried that script and I got a connection error. It seems that I cannot access the URL mentioned in the script either way.--Heitmann 04:37, 21 June 2010 (EDT)