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

Cannot encode unnamed element as 'hash'. Will be encoded as 'map' instead

Expand Messages
  • rsvancara
    I have created a very basic soap service that returns a hash of hashes. When I call my soap service, I see this in the apache error logs for every request I
    Message 1 of 1 , Jun 11, 2009
    • 0 Attachment
      I have created a very basic soap service that returns a hash of hashes. When I call my soap service, I see this in the apache error logs for every request I make.

      Cannot encode unnamed element as 'hash'. Will be encoded as 'map' instead

      Here is my code in a perl object method that returs the hash of hashes.

      sub getJobList {

      my $self = shift;

      # Get the result of the output
      my $result = `/usr/bin/qstat -f`;

      # An array that contains all the lines of the result
      my @result_array = split(/\n/,$result);

      # Hash to store all the jobs
      my %result_hash = ();

      # temporary hash to store attributes for a job
      my %temp_hash =();

      my $i = 1;

      my $jobid = 0;

      foreach my $line (@result_array){



      #Each job section is seperated by jobid
      #Iterate through the list and look for these "Job Id" lines
      if($line=~/^Job\sId:/){

      #if($i > 0){
      #$result_hash{$i} = \%temp_hash;
      #%temp_hash=();
      #}

      my @jobid_array = split(/:/,$line);
      #$jobid = $jobid_array[1];

      $jobid_array[1] =~s/^\s//;
      $jobid = $jobid_array[1];

      #$temp_hash{'jobid'} = $jobid_array[1];
      $result_hash{$jobid}{'jobid'} = $jobid;
      $i++;
      }

      # Job State, C for completed Q for queued
      if($line=~/job_state/){
      my @jobstate_array = split(/=/,$line);
      #$temp_hash{'job_state'} = $jobstate_array[1];
      $jobstate_array[1] =~s/^\s//;
      $result_hash{$jobid}{'job_state'} = $jobstate_array[1];
      }
      }

      return \%result_hash;
      }


      Here is the is my webservice cgi that uses the object method described above:

      #!/usr/bin/perl -w

      use strict;
      use grid::Grid;

      use SOAP::Transport::HTTP

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('grid::Grid')
      -> handle;

      So what can I do to eliminate this error.

      Thanks,

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