next up previous 107
Next: Supported data formats
Up: Web services
Previous: Displaying a time series using web serices


Creating a Fourier Transform using web serices

The web service interface also allows FROG to be used as an algorithim engine, the example Perl script below dispatches a time series to FROG which then calculates and returns a Fourier Transform for the series between the limits provided.

  #!/usr/bin/perl

  use SOAP::Lite;
  use Getopt::Long;

  unless ( scalar @ARGV >= 1 ) {
     die "USAGE: $0 [-host host] [-port port] -file filename\n";
  }
    
  my $status = GetOptions( "host=s"       => \$host,
                           "port=s"       => \$port,
                           "file=s"       => \$file,
                           "min=s"        => \$min_freq,
                           "max=s"        => \$max_freq,
                           "interval=s"   => \$interval );
  
  # default hostname
  unless ( defined $host ) {
     # localhost.localdoamin
     $host = "127.0.0.1";
  } 

  # default port
  unless( defined $port ) {
     # default port for the user agent
     $port = 8084;   
  } 
  
  my $data;
  if( defined $file ) {
     unless ( open ( FILE, "<$file") ) {
        die "ERROR: Cannot open $file\n";
     }
     undef $/;
     $data = <FILE>;
     close FILE;
  } else {
     die "ERROR: No data file specified.\n";
  }
  
  my $service = SOAP::Lite->service(
      "http://$host:$port/services/FrogSOAPServices?wsdl" );
    
  print $service->getFourierTransform( 
                     $data, $min_freq, $max_freq, $interval ) . "\n";



next up previous 107
Next: Supported data formats
Up: Web services
Previous: Displaying a time series using web serices

FROG - A Time Series Analysis Package
Starlink User Note 254
Alasdair Allan
21 Apr 2004
E-mail:frog@starlink.ac.uk

Copyright © 2001-2004 Council for the Central Laboratory of the Research Councils