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

Failed to invoke SOAP::Lite object with two parameters

Expand Messages
  • arthur_christoph
    Hi all: I tried to instantiate an object through soap::lite but failed when it involves two attributes in other words more than one element in the hash. Can
    Message 1 of 1 , Jun 21, 2005
    • 0 Attachment
      Hi all:
      I tried to instantiate an object through soap::lite but failed when it
      involves two attributes in other words more than one element in the
      hash. Can anyone help me to figure what could have been the cause?
      I have attached the client and server codes below.

      Thank you!
      Arthur

      #!C:\Perl\bin\perl -w
      use strict;
      use SOAP::Lite;

      --Client Side
      my $soap = SOAP::Lite
      -> uri('http://localhost:8080/Protein')
      -> proxy('http://localhost:8080/cgi-bin/SeedServer.cgi');
      #my $protein = $soap->newProtein_With_Name("Insulin")->result;
      #print $soap->getName($protein)->result;
      my $protein = $soap->newProtein_With_ID_And_Name(1,"Insulin")->result;
      print $soap->getName($protein)->result;
      #The error message: Element 'protname' can't be allowed in valid XML
      message. Died
      --

      --Server Side
      #!C:\Perl\bin\perl -w
      use strict;
      use SOAP::Transport::HTTP;

      use SOAP::Transport::HTTP;

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

      package Protein;

      sub newProtein_With_Name{
      #my $class = shift;
      my $self = shift;
      my $class = ref($self) || $self;
      #my $protid = shift;
      my $protname = shift;
      #my $self = bless {ID => $id, Name => $name}, $class;
      my $ref = {protname => $protname};
      print $protname;
      bless $ref, $class; #returns an instance of $self-a reference to an
      anonymous hash
      return $ref; #optional
      }

      sub newProtein_With_ID_And_Name{
      #my $class = shift;
      my $self = shift;
      my $class = ref($self) || $self;
      my $protid = shift;
      my $protname = shift;
      my $ref = {protid => $protid, protname => $protname};
      bless $ref, $class; #returns an instance of $self-a reference to an
      anonymous hash
      return $ref;
      }

      sub getName{
      my $self = shift;
      $self->{protname};
      }

      sub getID{
      my $self = shift;
      $self->{protid};
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.