ActivLinks - 2005-06-02

hi,

I alter the hibyemix.cgi: service dispatch example from
the userguide section at soaplite.com to include the
Temperatures service example to work in mod_perl
environment.

The Temperatures example temper.cgi + tempobj.pl works
and return result as expected. but when i tried with
the code below, the client code's return cycles between
3 different output: 37, -17, and <no output>

i've turned on the +trace option and i notice
differences in the xml response where the call to NEW
method and xml request where the call to AS_CELCIUS
method for each case: where output is -17- call to NEW
method failed, and in case no output - call to
AS_CELCIUS method is failed.

Please let me know where thing gone wrong. thanks.
---------------------

Here are the code i used:

########################
# APACHE.PM
########################

package Shared::Apache;

use SOAP::Transport::HTTP;

my $server = SOAP::Transport::HTTP::Apache
-> dispatch_to('/home/soaplite/modules');

sub handler { $server->handler(@_) }

1;

########################
# TEMPERATURES.PM - the server
########################

package Temperatures;

sub f2c {
my ($class, $f) = @_;
return 5/9*($f-32);
}

sub c2f {
my ($class, $c) = @_;
return 32+$c*9/5;
}

sub new {
my $self = shift;
my $class = ref($self) || $self;
bless {_temperature => shift} => $class;
}

sub as_fahrenheit {
return shift->{_temperature};
}

sub as_celsius {
return 5/9*(shift->{_temperature}-32);
}

1;

########################
# TEMPOBJ.PL
########################

#!/usr/local/perl5.8/bin/perl

my $soap = SOAP::Lite
-> uri('Temperatures')
-> proxy('http://10.3.2.87/soap');

my $temperatures = $soap
-> call(new => 100) # accept Fahrenheits
-> result;

print $soap
-> as_celsius($temperatures)
-> result;