source: webservices/se.lu.thep.webservices/trunk/test.pl @ 1430

Last change on this file since 1430 was 415, checked in by Jari Häkkinen, 15 years ago

The demo server is not listening on port 8080 anymore.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#! /usr/bin/perl -w
2
3# $Id: test.pl 415 2007-09-03 09:40:50Z jari $
4
5use BaseWebService;
6use strict;
7use Data::Dumper;
8
9#############################################################
10#
11# This is small script to test the BaseWebService.pm module
12#
13#############################################################
14
15# Create the BaseWebService object
16my $obj = BaseWebService->new(baseUrl => 'http://base2.thep.lu.se/demo');
17my $sessionID = $obj->sessionID();
18print "Session ID = $sessionID \n";
19
20# Login, change to fit your account
21#$obj->login('userid', 'password');
22$obj->login('base2', 'base2');
23
24# Get all the projects
25my $projs = $obj->getProjects();
26print "List of Projects:\n";
27foreach my $proj (@{$projs}) {
28    print "Id         : ", $proj->{id}, "\n";
29    print "Name       : ", $proj->{name}, "\n";
30    print "Description: ", 
31    ($proj->{description} ? '' : defined($proj->{description})), "\n\n";
32}   
33# Make an array of all project ID's
34my @projID = map { $_->{id} } @{$projs};
35
36
37# Set active project. This is an important step, since
38# you have to have your project in an active state.
39# Here I simply select the first project ID.
40$obj->setActiveProject($projID[0]);
41
42# Get a listing of all experiments (At the moment you get a list of all
43# experiments, unfortunately not only for the active project.
44my $exps = $obj->getExperiments(); 
45
46print "List of Experiments:\n";
47foreach my $exp (@{$exps}) {
48    print "Id         : ", $exp->{id}, "\n";
49    print "Name       : ", $exp->{name}, "\n";
50    print "Description: ", 
51    ($exp->{description} ? '' :  defined($exp->{description})), "\n\n";
52}   
53
54# Make an array of all experiment ID's
55my @expID = map { $_->{id} } @{$exps};
56
57# Call the getRawBioAssays for the first one (if you have any)
58if( @expID ) {
59    my $useExpID = $expID[0];
60    print "Raw bioassays for experiment with ID = $useExpID\n";
61    my $files = $obj->getRawBioAssays_by_expID($useExpID);
62    foreach my $file (@$files) {
63  print "celfile: $file->{celFile} (design = $file->{cdfFile})\n";
64    }
65
66    # Download all files to the local directory. Uncomment to apply!
67    #$obj->downloadRawBioAssays($files, './');
68}
69
70# Here you can download all files at once given an experiment ID
71#if( @expID ) {
72#    $obj->downloadRawBioAssays_by_expID($expID[0], './tmp');
73#}
74
75# Logout
76$obj->logout();
Note: See TracBrowser for help on using the repository browser.