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

A soap-lite server for interfacing a class with an object oriented interface.

Expand Messages
  • wxyc
    Hi, There. I am quite new to Soap::Lite, and I was following the info on www.soaplite.com to find out the way to set up ws server and clients. At this moment,
    Message 1 of 1 , Jul 23, 2004
    • 0 Attachment
      Hi, There.

      I am quite new to Soap::Lite, and I was following the info on
      www.soaplite.com to find out the way to set up ws server and clients.

      At this moment, a CGI based server works just fine for me and I was
      looking at the example (2.b, temper.cgi) to get a sense on writing a
      cgi-based server for a class with an object-oriented interface.

      The class I am writing will bave to take named parameters in the new()
      method. For example:

      ------------------------------8<--------------------------------
      package TempMois;

      sub new {
      my $self = shift;
      my $class = ref($self) || $self;
      my %args = (@_);
      bless {_temperature => $args{temperature},
      _moisture => $args{moisture}
      } => $class;
      }
      sub temperatureIs {
      return shift->{_temperature};
      }

      sub moistureIs {
      return shift->{_moisture};
      }
      1;
      ------------------------------8<--------------------------------

      Therefore, normally, the way to instantialize a TempMois Object would
      be:

      TempMois->new( temperature => 97,
      moisture => 60
      );

      Writing the cgi-based server for this class is easy and straitforward,
      however wriring a client WITHOUT using the autodispatch is quite
      confused to me. (Note: using the autodispatch, the client works just
      fine. ). The following is my client code via the non-autodispatch
      route:

      ------------------------------8<--------------------------------
      my $soap = SOAP::Lite
      -> uri('http://foo.bar.com/TempMois')
      -> roxy('http://foo.bar.com/webservices/TempMois.cgi');
      my %h;
      $h{temperature} = 97;
      $h{moisture} = 60;
      my $tmObj = $soap
      -> call(new=>%h) # ??? This is where I got losted
      -> result;

      print $soap
      -> temperatureIs($defObj)
      -> result;

      print $soap
      -> moistureIs($defObj)
      -> result;
      ------------------------------8<--------------------------------

      As you can see, I got losted around the call(). Did I miss something?

      Thanks for pointing out the way.


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