Failed to invoke SOAP::Lite object with two parameters



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;

my $protein = Protein->newProtein_With_ID_And_Name(1,"Insulin");
print $protein->getName;
print $protein->getID;

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};
}

.



Relevant Pages

  • Re: Self referencing hash
    ... my $class = shift; ... sub type { ... You should also call it something better than HASH because the % ... one of the hash values an anonymous array. ...
    (perl.beginners)
  • code references - how to
    ... I have tried putting junk values in the hash values - sub ... So how do you create a code reference in this context, ... my $root = shift; ...
    (perl.beginners)
  • Re: hash on private member variable
    ... What does it mean to "use hash on a private member variable"? ... > sub new { ... > my $class = shift; ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Multileval data structures, tie, and indirection
    ... A map is one 2D level, ... hash of data about the grid. ... sub TIEARRAY { ... my $class = shift; ...
    (comp.lang.perl)
  • RE: Hash problem
    ... My hash is showing the address instead of the name and I'm not sure ... HASHis missing preserver ... my $all = shift; ... sub check_items_required { ...
    (perl.beginners)