Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] How can you determine the name and type of rpc variables on the server side?

Expand Messages
  • Scott Jackson
    ... Duncan, Thanks for the reference. In the section you referred me to I discovered that I can get direct access to the envelope by inheriting from
    Message 1 of 3 , Dec 9, 2005
    View Source
    • 0 Attachment
      > See the section ACCESSING HEADERS AND ENVELOPE ON SERVER SIDE in the docs for how to get hold of the SOAP envelope.
      > You can then use the SOAP::SOM methods to navigate through the child elements of the jobSubmit element and pick out the name, type and value.
      >
      > Something like this might be what you need
      >
      > my $j = $som->match('/Envelope/Body/[1]');
      >
      > for (my $i = 1; my $e = $j->dataof("[$i]"); $i++) {
      > print $e->name , ' ', $e->type, ' ', $e->value, "\n";
      > };

      Duncan,

      Thanks for the reference. In the section you referred me to I discovered
      that I can get direct access to the envelope by inheriting from
      SOAP::Server::Parameters. That was the key I was missing. Since all I
      really needed in this instance were the names (and not the types), it
      was a simple matter to extract the names and values with the 'method'
      call on the SOAP::SOM object popped from the extended parameters.


      package Moab::WebServices;

      use Data::Dumper;
      use Exporter;
      @ISA = qw(Exporter SOAP::Server::Parameters);
      @EXPORT = qw
      (
      &jobStart
      );

      # Start a job
      sub jobStart
      {
      my $som = pop;

      my %args = %{$som->method};
      return "jobStart received: " . Data::Dumper->Dump([\%args]);
      }

      1;

      ####

      I get a response like:

      jobStart received: $VAR1 = {
      'NAME' => 'PBS.1234.0',
      'UNAME' => 'scottmo',
      'TASKLIST' => 'node01,node02',
      'WCTIME' => '12:00:00',
      'EXEC' => '/bin/hostname'
      };

      ####


      Thank you so much for your help!

      Scott
    Your message has been successfully submitted and would be delivered to recipients shortly.