Using FSU Web Services from Perl

I recommend using the Perl module SOAP::XML::Client::DotNet. It runs over SOAP::Lite, but caters to Microsoft's quirks seamlessly (if you consult the man pages for SOAP::Lite, you can see that there are several issues to overcome.)

I have written a small wrapper for a SAX parser at xmlleaves.pm; you merely indicate where in the tree you want to start collecting leaves, and the leaves are stored in the handler object when you invoke the parser. They are stored as an array of hash references, or if you want to use the wrapper's method, you can invoke the shift_var method and it will remove one of the hashes from the list and return it to you.

You can then write code similar to this:


#!/usr/bin/perl -w

use strict;

use Data::Dumper;

use SOAP::Lite ( +trace => 'all', readable => 1, outputxml => 1, );
use SOAP::XML::Client::DotNet;
use XML::SAX::ParserFactory;
use xmlleaves;

my $soap_client = SOAP::XML::Client::DotNet->new
    (
     {
	 uri          => 'http://oti.fsu.edu',
	 proxy        => 'http://netdev.oti.fsu.edu/GraduateFacultyStatus/GraduateStatusService.asmx',
	 xmlns        => 'http://oti.fsu.edu/',
	 soapversion  => '1.1',
	 timeout      => '30'
     }
    );

my $xml = '<AuthorizedKey></AuthorizedKey><AuthorizedRole>DDC</AuthorizedRole><DegreeProgramCode _value_type=\'string\'>110101</DegreeProgramCode>';
    
if($soap_client->fetch({ method => 'AuthorizedByDegreeProgram', xml => $xml}))
{
  my $xml_string = $soap_client->results();

  my $handler = xmlleaves->new();
  my $parser = XML::SAX::ParserFactory->parser(Handler => $handler);

  # this tells the handler where in the XML tree to start collecting leaves...
  $handler->specify_element_of_interest("GraduateFacultyStatus");

  $parser->parse_string($xml_string);

  # a utility routine to let you see the list of leaves the parser found
  $handler->print_vars();

  # simple way to pull leaves from the list
  my $var;
  while( $var = $handler->shift_var() )
    {
      print "---> " . Dumper($var) . "\n";
    }

}
  else
{
    print "Hmmm...\n";
    print $soap_client->error() . "\n";
}