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

using objects : object reference not returned by soapserver as obj. ref.

Expand Messages
  • paul_masquelier2003 <paul_masquelier2003
    Hello, I am experiencing a problem that is probably of the same origin as those of fallinj : - I create an object whose (scalar) reference (a scalar reference
    Message 1 of 1 , Feb 26, 2003
    • 0 Attachment
      Hello,

      I am experiencing a problem that is probably of the same origin as
      those of fallinj :

      - I create an object whose (scalar) reference (a scalar reference for
      simplicity) is returned by the soaplite server to the client
      - the client tries to call a method on this object, using the
      returned object reference

      This fails :
      error message : "Use of initialized value at..."

      The hint of Bruno Connelly in a messsage of this morning to set of
      autotype also seems applicable in this situation.

      What is the proper why to set this autotype of ?
      For quick results, I temporarily changed the default of _autotype in
      the hash of Serialiser to 0 in Lite.pm, this did not solve my problem
      however.

      Here is the code for a very simple test I am trying to make work :

      --------------
      TestPackage.pm :

      package TestPackage;

      sub new
      {
      my $this = shift;
      my $class = ref($this) || $this;
      my $name = shift;
      my $self = \$name; # SCALAR REFERENCE, USED AS OBJECT REF
      bless ( $self, $class);
      }

      sub TestFunc
      {
      my $self = shift;

      my $name = ${$self};
      return $name;
      }

      1;

      --------------------------

      TestPackageClient.pl : (no package anymore since I reduced it to the
      bare minimum)

      use SOAP::Lite;

      my $soaplite = SOAP::Lite->uri('http://www.mytest.be/TestPackage')-
      >proxy('tcp://localhost:82/'); # local tcp server

      my $objref = $soaplite->call(new => 100)->result;

      # FAILS : "Use of initialized value"
      # $objref has apparently not been returned as a scalar reference
      print $soaplite->TestFunc($objref)->result;
      #print $soaplite->call(TestFunc => $objref)->result;

      1;

      -------------------------

      SoapTcpServerPerl.pm :

      package SoapTcpServerPerl;

      use SOAP::Lite +trace => qw(all);

      use SOAP::Transport::TCP;
      my $daemon;

      sub new()
      {
      $daemon = SOAP::Transport::TCP::Server
      -> new (LocalAddr => 'localhost', LocalPort => 82, Listen => 5,
      Reuse => 1)
      -> dispatch_to('.') # 1
      ;
      bless( {}, shift);
      }

      sub handle()
      {
      $daemon->handle;
      }

      1;

      ----------------------
      SoapTcpServerTester.pl :

      use SoapTcpServerPerl;
      my $soaptcpserver = SoapTcpServerPerl->new;
      $soaptcpserver->handle();
      1;

      --------------------

      Has anyone a solution how not to loose object references ?
      Thanks a lot,

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