source: trunk/se/lu/thep/webservices_clients/test.pl @ 275

Last change on this file since 275 was 260, checked in by Jari Häkkinen, 16 years ago

Fixed svn properties, 2nd try.

  • 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 260 2007-04-20 16:30:44Z 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:8080/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.