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

little confused

Expand Messages
  • Jason Yates
    How could a perl soap client access the show_tables method below? Also how would you pass username and password to the new method. For instance, using a
    Message 1 of 10 , Nov 21, 2002
    • 0 Attachment
      How could a perl soap client access the show_tables method below? Also how
      would you pass username and password to the new method. For instance, using
      a couple elements in the soap header?

      #!/usr/bin/perl

      use SOAP::Transport::HTTP;
      use DBI;

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

      package DB::mysql;

      sub new {
      my($class,%args) = @_;
      my $self = {};
      bless $self, $class;

      $args{'user'} ||= 'root';
      $args{'pass'} || ='password';

      my $dsn = "DBI:mysql:database=mysql;host=127.0.0.1;port=3306";
      my $dbh = DBI->connect($dsn,$args{'user'},$args{'pass'});

      $self->{'dbh'} = $dbh;
      return $self;
      }

      sub show_tables {
      my($self,$database) = @_;
      my $dbh = $self->{'dbh'};
      my @tables;


      $dbh->do("use $database");
      my $sth = $dbh->prepare("show tables");
      $sth->execute();
      while(my $table = $sth->fetchrow_array()) {
      push(@tables, $table);
      }
      return @tables;
      }
    • Byrne Reese
      Try this: #!/usr/bin/perl -w ################################################### use SOAP::Lite; # +trace = qw(debug transport); $HOST =
      Message 2 of 10 , Nov 21, 2002
      • 0 Attachment
        Try this:
         
        #!/usr/bin/perl -w
        ###################################################
        use SOAP::Lite; # +trace => qw(debug transport);
        $HOST     = 'http://URL/showtables.cgi';
        $NS       = "urn:ShowTables";
        ###################################################
        # DO NOT EDIT ANYTHING BELOW THIS LINE            #
        ###################################################
        use Getopt::Long;
        use Pod::Usage;
        my $help = 0;
        $result = GetOptions ('help|?'      => \$help,
              "username=s"  => \$USERNAME,
              "password=s"  => \$PASSWORD)
          or pod2usage(2);
        my $DATABASE = $ARGV[0];
        pod2usage(1) if $help || !$USERNAME || !$PASSWORD || !$DATABASE;
        ###################################################
        my $soap = SOAP::Lite
          ->readable(1)
          ->uri($NS)
          ->proxy($HOST);

        ### Of course I am adding the username and password as arguments... you don't need them for the implementation you have
        ### below.
        my $som = $soap->show_tables($USERNAME,$PASSWORD,$DATABASE);

        print "The response from the server was:\n".$som->result."\n";

        1;
        ## pretty easy, eh? Just call the subroutines in the service as you would call a method of the $soap object above.
         

        -----Original Message-----
        From: Jason Yates [mailto:jaywhy2@...]
        Sent: Thursday, November 21, 2002 11:24 AM
        To: soaplite@yahoogroups.com
        Subject: [soaplite] little confused

        How could a perl soap client access the show_tables method below?  Also how
        would you pass username and password to the new method.  For instance, using
        a couple elements in the soap header?

        #!/usr/bin/perl

        use SOAP::Transport::HTTP;
        use DBI;

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

        package DB::mysql;

        sub new {
                my($class,%args) = @_;
                my $self = {};
                bless $self, $class;
             
              $args{'user'} ||= 'root';
              $args{'pass'} || ='password';

                my $dsn = "DBI:mysql:database=mysql;host=127.0.0.1;port=3306";
                my $dbh = DBI->connect($dsn,$args{'user'},$args{'pass'});

                $self->{'dbh'} = $dbh;
                return $self;
        }

        sub show_tables {
                my($self,$database) = @_;
                my $dbh = $self->{'dbh'};
                my @tables;


                $dbh->do("use $database");
                my $sth = $dbh->prepare("show tables");
                $sth->execute();
                while(my $table = $sth->fetchrow_array()) {
                        push(@tables, $table);
                }
                return @tables;
        }


        To unsubscribe from this group, send an email to:
        soaplite-unsubscribe@yahoogroups.com



        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
      • Jason Yates
        Thanks for the reply, but I m still lost. Where did you get the urn ShowTables ? Also I m looking more for dispatching a OO type module. How would I call
        Message 3 of 10 , Nov 22, 2002
        • 0 Attachment
          Thanks for the reply, but I'm still lost. Where did you get the urn
          "ShowTables"? Also I'm looking more for dispatching a OO type module. How
          would I call the new function?

          I've noticed you can autodispatch modules. For example,

          use SOAP::Lite +autodispatch =>
          uri => 'http://www.soaplite.com/Temperatures',
          proxy => 'http://services.soaplite.com/temper.cgi';
          my $temperatures = Temperatures->new(32);
          print $temperatures->as_celsius;

          The problem with the fictional module DB::mysql is it's an exact package name,
          unlike Temperatures which can be Autoloaded. Nor is DB::mysql a suspectible
          uri.

          my $soap = SOAP::Lite
          ->uri('http://127.0.0.1/DB::mysql')
          ->proxy('http://127.0.0.1/cgi-bin/db.cgi');

          Just doesn't work.


          Jason Yates

          On Thursday 21 November 2002 18:13, Byrne Reese wrote:
          > Try this:
          >,
          > #!/usr/bin/perl -w
          > ###################################################
          > use SOAP::Lite; # +trace => qw(debug transport);
          > $HOST = 'http://URL/showtables.cgi';
          > $NS = "urn:ShowTables";
          > ###################################################
          > # DO NOT EDIT ANYTHING BELOW THIS LINE #
          > ###################################################
          > use Getopt::Long;
          > use Pod::Usage;
          > my $help = 0;
          > $result = GetOptions ('help|?' => \$help,
          > "username=s" => \$USERNAME,
          > "password=s" => \$PASSWORD)
          > or pod2usage(2);
          > my $DATABASE = $ARGV[0];
          > pod2usage(1) if $help || !$USERNAME || !$PASSWORD || !$DATABASE;
          > ###################################################
          > my $soap = SOAP::Lite
          > ->readable(1)
          > ->uri($NS)
          > ->proxy($HOST);
          >
          > ### Of course I am adding the username and password as arguments... you
          > don't need them for the implementation you have
          > ### below.
          > my $som = $soap->show_tables($USERNAME,$PASSWORD,$DATABASE);
          >
          > print "The response from the server was:\n".$som->result."\n";
          >
          > 1;
          >
          > ## pretty easy, eh? Just call the subroutines in the service as you would
          > call a method of the $soap object above.
          >
          >
          > -----Original Message-----
          > From: Jason Yates [mailto:jaywhy2@...]
          > Sent: Thursday, November 21, 2002 11:24 AM
          > To: soaplite@yahoogroups.com
          > Subject: [soaplite] little confused
          >
          >
          >
          > How could a perl soap client access the show_tables method below? Also how
          > would you pass username and password to the new method. For instance,
          > using
          >
          > a couple elements in the soap header?
          >
          > #!/usr/bin/perl
          >
          > use SOAP::Transport::HTTP;
          > use DBI;
          >
          > SOAP::Transport::HTTP::CGI->dispatch_to('DB::mysql')->handle;
          >
          > package DB::mysql;
          >
          > sub new {
          > my($class,%args) = @_;
          > my $self = {};
          > bless $self, $class;
          >
          > $args{'user'} ||= 'root';
          > $args{'pass'} || ='password';
          >
          > my $dsn = "DBI:mysql:database=mysql;host=127.0.0.1;port=3306";
          > my $dbh = DBI->connect($dsn,$args{'user'},$args{'pass'});
          >
          > $self->{'dbh'} = $dbh;
          > return $self;
          > }
          >
          > sub show_tables {
          > my($self,$database) = @_;
          > my $dbh = $self->{'dbh'};
          > my @tables;
          >
          >
          > $dbh->do("use $database");
          > my $sth = $dbh->prepare("show tables");
          > $sth->execute();
          > while(my $table = $sth->fetchrow_array()) {
          > push(@tables, $table);
          > }
          > return @tables;
          > }
          >
          >
          > Yahoo! Groups Sponsor
          >
          > ADVERTISEMENT
          >
          > <http://rd.yahoo.com/M=237459.2675695.4055211.2225243/D=egroupweb/S=1705701
          >0
          > 14:HM/A=1267611/R=0/*http://ad.doubleclick.net/jump/N2524.Yahoo/B1071650;sz
          >= 300x250;ord=1037906626058019?>
          >
          > <http://us.adserver.yahoo.com/l?M=237459.2675695.4055211.2225243/D=egroupma
          >i l/S=:HM/A=1267611/rand=233483143>
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
          > <http://docs.yahoo.com/info/terms/> .
        • Byrne Reese
          urn:ShowTables is completely arbitrary - it is just a namespace. Ok, so let me break down my example client a bit more... ... The host and ns are for you to
          Message 4 of 10 , Nov 22, 2002
          • 0 Attachment
            urn:ShowTables is completely arbitrary - it is just a namespace. Ok, so let me break down my example client a bit more...
             
            > #!/usr/bin/perl -w
            >
            ###################################################
            > use SOAP::Lite; # +trace => qw(debug transport);
            > $HOST     = '
            href="http://url/showtables.cgi';">http://URL/showtables.cgi';
            > $NS       = "urn:ShowTables";
            The host and ns are for you to configure. The host is the URL to post your request to. The namespace must correspond to the namespace declaration of the service you are invoking.
             
            > ###################################################
            > # DO NOT EDIT
            ANYTHING BELOW THIS LINE            #
            >
            ###################################################
            > use
            Getopt::Long;
            > use Pod::Usage;
            > my $help = 0;
            > $result =
            GetOptions ('help|?'      => \$help,
            >       "username=s"  =>
            \$USERNAME,
            >       "password=s"  =>
            \$PASSWORD)
            >   or pod2usage(2);
            > my $DATABASE =
            $ARGV[0];
            > pod2usage(1) if $help || !$USERNAME || !$PASSWORD ||
            !$DATABASE;
            >
            ###################################################
            This is just handy stuff I do for the command line. It makes printing a usage statement really easy, especially if you have Perl POD documentation embedded in your script... In any event, this is how the username and password for the database is passed in. In you server example you hard code the username and password, which is fine, but if you wanted to add an additional layer of security, this might be how you do it.
             
            > my $soap = SOAP::Lite
            >   ->readable(1)
            >  
            ->uri($NS)
            >   ->proxy($HOST);
             
            Ok, here is the meat. All we are doing here is creating a client instance of SOAP::Lite. No calls have been made yet. All you are saying is that you want to XML to be "readable", you specify the namespace, and URL to connect with.

            > ### Of course I am adding the username and password as arguments... you
            > ### don't need them
            for the implementation you have
            > ### below.
            > my $som =
            $soap->show_tables($USERNAME,$PASSWORD,$DATABASE);
             
            Here you actually make your call to the remote service. What is really cool about SOAP::Lite is how it serializes and deserializes the method call for you. For example, you identified the service above with the "->proxy()" call. Now, if you want to send a request to that service and invoke a method (or I should say subroutine) called "invoke_me_now()" then simply invoke that method as if it were a member of the SOAP::Lite instance we just created.
             
            So, your CGI has a method called show_tables($db) - just say:
            $soap->show_tables("mydb");
            And you will call the remote method. Done and done.
             
            Now a SOAP::SOM object is returned. To access elements in the SOAP::SOM object, let me direct you to the following client example I wrote for the Amazon Web service:
             
             
            > print "The response from the server was:\n".$som->result."\n";
            >
            > 1;
             
            I always end my perl programs with a 1; so that I am assured that 1 is returned by the program when finished... it is just a style thing. :-/
             
            Let me know if you have further questions, I would be happy to help.

             
            -----Original Message-----
            From: Jason Yates [mailto:jaywhy2@...]
            Sent: Friday, November 22, 2002 9:20 AM
            To: Byrne Reese; soaplite@yahoogroups.com
            Subject: Re: [soaplite] little confused

            Thanks for the reply, but I'm still lost.  Where did you get the urn
            "ShowTables"?  Also I'm looking more for dispatching a OO type module.  How
            would I call the new function? 

            I've noticed you can autodispatch modules.  For example,

            use SOAP::Lite +autodispatch =>
              uri => 'http://www.soaplite.com/Temperatures',
              proxy => 'http://services.soaplite.com/temper.cgi';
            my $temperatures = Temperatures->new(32);
            print $temperatures->as_celsius;

            The problem with the fictional module DB::mysql is it's an exact package name,
            unlike Temperatures which can be Autoloaded.  Nor is DB::mysql a suspectible
            uri.

            my $soap = SOAP::Lite
              ->uri('http://127.0.0.1/DB::mysql')
              ->proxy('http://127.0.0.1/cgi-bin/db.cgi');

            Just doesn't work.


            Jason Yates

            On Thursday 21 November 2002 18:13, Byrne Reese wrote:
            > Try this:
            >,
            > #!/usr/bin/perl -w
            > ###################################################
            > use SOAP::Lite; # +trace => qw(debug transport);
            > $HOST     = 'http://URL/showtables.cgi';
            > $NS       = "urn:ShowTables";
            > ###################################################
            > # DO NOT EDIT ANYTHING BELOW THIS LINE            #
            > ###################################################
            > use Getopt::Long;
            > use Pod::Usage;
            > my $help = 0;
            > $result = GetOptions ('help|?'      => \$help,
            >       "username=s"  => \$USERNAME,
            >       "password=s"  => \$PASSWORD)
            >   or pod2usage(2);
            > my $DATABASE = $ARGV[0];
            > pod2usage(1) if $help || !$USERNAME || !$PASSWORD || !$DATABASE;
            > ###################################################
            > my $soap = SOAP::Lite
            >   ->readable(1)
            >   ->uri($NS)
            >   ->proxy($HOST);
            >
            > ### Of course I am adding the username and password as arguments... you
            > don't need them for the implementation you have
            > ### below.
            > my $som = $soap->show_tables($USERNAME,$PASSWORD,$DATABASE);
            >
            > print "The response from the server was:\n".$som->result."\n";
            >
            > 1;
            >
            > ## pretty easy, eh? Just call the subroutines in the service as you would
            > call a method of the $soap object above.
            >
            >
            > -----Original Message-----
            > From: Jason Yates [mailto:jaywhy2@...]
            > Sent: Thursday, November 21, 2002 11:24 AM
            > To: soaplite@yahoogroups.com
            > Subject: [soaplite] little confused
            >
            >
            >
            > How could a perl soap client access the show_tables method below?  Also how
            > would you pass username and password to the new method.  For instance,
            > using
            >
            > a couple elements in the soap header?
            >
            > #!/usr/bin/perl
            >
            > use SOAP::Transport::HTTP;
            > use DBI;
            >
            > SOAP::Transport::HTTP::CGI->dispatch_to('DB::mysql')->handle;
            >
            > package DB::mysql;
            >
            > sub new {
            >         my($class,%args) = @_;
            >         my $self = {};
            >         bless $self, $class;
            >
            >       $args{'user'} ||= 'root';
            >       $args{'pass'} || ='password';
            >
            >         my $dsn = "DBI:mysql:database=mysql;host=127.0.0.1;port=3306";
            >         my $dbh = DBI->connect($dsn,$args{'user'},$args{'pass'});
            >
            >         $self->{'dbh'} = $dbh;
            >         return $self;
            > }
            >
            > sub show_tables {
            >         my($self,$database) = @_;
            >         my $dbh = $self->{'dbh'};
            >         my @tables;
            >
            >
            >         $dbh->do("use $database");
            >         my $sth = $dbh->prepare("show tables");
            >         $sth->execute();
            >         while(my $table = $sth->fetchrow_array()) {
            >                 push(@tables, $table);
            >         }
            >         return @tables;
            > }
            >
            >
            > Yahoo! Groups Sponsor
            >
            > ADVERTISEMENT
            >
            > <http://rd.yahoo.com/M=237459.2675695.4055211.2225243/D=egroupweb/S=1705701
            >0
            > 14:HM/A=1267611/R=0/*http://ad.doubleclick.net/jump/N2524.Yahoo/B1071650;sz
            >= 300x250;ord=1037906626058019?>
            >
            > <http://us.adserver.yahoo.com/l?M=237459.2675695.4055211.2225243/D=egroupma
            >i l/S=:HM/A=1267611/rand=233483143>
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
            > <http://docs.yahoo.com/info/terms/> .



            To unsubscribe from this group, send an email to:
            soaplite-unsubscribe@yahoogroups.com



            Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          • Jason Yates
            Thanks for responding. I think you misunderstood my question. I m didn t have any trouble understanding your example client, other then the fact of being
            Message 5 of 10 , Nov 23, 2002
            • 0 Attachment
              Thanks for responding.

              I think you misunderstood my question. I'm didn't have any trouble
              understanding your example client, other then the fact of being confused on
              how you came up with a urn of ShowTables.

              The method call below, in your example client, will not work properly because
              you haven't created the DB::mysql object yet using the new function.

              $soap->show_tables("mydb"); <-wont' work...

              This is where I was confused. The OO example given in the SOAP::Lite
              documentation doesn't really shed much light.

              use SOAP::Lite +autodispatch =>
              uri => http://www.soaplite.com/Temperatures,
              proxy => http://services.soaplite.com/temper.cgi;

              my $temperatures = Temperatures->new(32); # get object
              print $temperatures->as_celsius; # invoke method

              Temperatures is the package, method calls are autodispatched to the soap
              service using the UNIVERSAL::AUTOLOAD module. The example above won't work
              with my package.

              use SOAP::Lite +autodispatch =>
              uri => http://www.soaplite.com/DB::mysql, <-----not a valid URI
              proxy => http://services.soaplite.com/temper.cgi;

              my $temperatures = DB::mysql->new(32); <-----Can't be autloaded.
              print $temperatures->as_celsius; # invoke method

              The package name DB::mysql is an exact package location perse, because of the
              the "::". Therefore perl will look for the package DB::mysql in the paths
              listed in the @INC variable, and not get autoloaded by the SOAP::Lite module.


              Jason Yates


              On Friday 22 November 2002 12:39, Byrne Reese wrote:
              > ------_=_NextPart_001_01C2924E.1E1C49F0
              > Content-Type: text/plain;
              > charset="iso-8859-1"
              >
              > urn:ShowTables is completely arbitrary - it is just a namespace. Ok, so let
              > me break down my example client a bit more...
              >
              > > #!/usr/bin/perl -w
              > > ###################################################
              > > use SOAP::Lite; # +trace => qw(debug transport);
              > > $HOST = ' <http://url/showtables.cgi';> http://URL/showtables.cgi';
              > > $NS = "urn:ShowTables";
              >
              > The host and ns are for you to configure. The host is the URL to post your
              > request to. The namespace must correspond to the namespace declaration of
              > the service you are invoking.
              >
              > > ###################################################
              > > # DO NOT EDIT ANYTHING BELOW THIS LINE #
              > > ###################################################
              > > use Getopt::Long;
              > > use Pod::Usage;
              > > my $help = 0;
              > > $result = GetOptions ('help|?' => \$help,
              > > "username=s" => \$USERNAME,
              > > "password=s" => \$PASSWORD)
              > > or pod2usage(2);
              > > my $DATABASE = $ARGV[0];
              > > pod2usage(1) if $help || !$USERNAME || !$PASSWORD || !$DATABASE;
              > > ###################################################
              >
              > This is just handy stuff I do for the command line. It makes printing a
              > usage statement really easy, especially if you have Perl POD documentation
              > embedded in your script... In any event, this is how the username and
              > password for the database is passed in. In you server example you hard code
              > the username and password, which is fine, but if you wanted to add an
              > additional layer of security, this might be how you do it.
              >
              > > my $soap = SOAP::Lite
              > > ->readable(1)
              > > ->uri($NS)
              > > ->proxy($HOST);
              >
              > Ok, here is the meat. All we are doing here is creating a client instance
              > of SOAP::Lite. No calls have been made yet. All you are saying is that you
              > want to XML to be "readable", you specify the namespace, and URL to connect
              > with.
              >
              > > ### Of course I am adding the username and password as arguments... you
              > > ### don't need them for the implementation you have
              > > ### below.
              > > my $som = $soap->show_tables($USERNAME,$PASSWORD,$DATABASE);
              >
              > Here you actually make your call to the remote service. What is really cool
              > about SOAP::Lite is how it serializes and deserializes the method call for
              > you. For example, you identified the service above with the "->proxy()"
              > call. Now, if you want to send a request to that service and invoke a
              > method (or I should say subroutine) called "invoke_me_now()" then simply
              > invoke that method as if it were a member of the SOAP::Lite instance we
              > just created.
              >
              > So, your CGI has a method called show_tables($db) - just say:
              > $soap->show_tables("mydb");
              > And you will call the remote method. Done and done.
              >
              > Now a SOAP::SOM object is returned. To access elements in the SOAP::SOM
              > object, let me direct you to the following client example I wrote for the
              > Amazon Web service:
              >
              > <http://majordojo.com/amazon_query/client.php>
              > http://majordojo.com/amazon_query/client.php
              >
              > > print "The response from the server was:\n".$som->result."\n";
              > >
              > > 1;
              >
              > I always end my perl programs with a 1; so that I am assured that 1 is
              > returned by the program when finished... it is just a style thing. :-/
              >
              > Let me know if you have further questions, I would be happy to help.
              >
              >
              >
              > -----Original Message-----
              > From: Jason Yates [mailto:jaywhy2@...]
              > Sent: Friday, November 22, 2002 9:20 AM
              > To: Byrne Reese; soaplite@yahoogroups.com
              > Subject: Re: [soaplite] little confused
              >
              >
              > Thanks for the reply, but I'm still lost. Where did you get the urn
              > "ShowTables"? Also I'm looking more for dispatching a OO type module. How
              > would I call the new function?
              >
              > I've noticed you can autodispatch modules. For example,
              >
              > use SOAP::Lite +autodispatch =>
              > uri => ' http://www.soaplite.com/Temperatures',
              > <http://www.soaplite.com/Temperatures',>
              > proxy => ' http://services.soaplite.com/temper.cgi';
              > <http://services.soaplite.com/temper.cgi';>
              > my $temperatures = Temperatures->new(32);
              > print $temperatures->as_celsius;
              >
              > The problem with the fictional module DB::mysql is it's an exact package
              > name,
              > unlike Temperatures which can be Autoloaded. Nor is DB::mysql a
              > suspectible
              >
              > uri.
              >
              > my $soap = SOAP::Lite
              > ->uri(' http://127.0.0.1/DB::mysql') <http://127.0.0.1/DB::mysql')>
              > ->proxy(' http://127.0.0.1/cgi-bin/db.cgi');
              > <http://127.0.0.1/cgi-bin/db.cgi');>
              >
              > Just doesn't work.
              >
              >
              > Jason Yates
              >
              > > -----Original Message-----
              > > From: Jason Yates [mailto:jaywhy2@...]
              > > Sent: Thursday, November 21, 2002 11:24 AM
              > > To: soaplite@yahoogroups.com
              > > Subject: [soaplite] little confused
              > >
              > >
              > >
              > > How could a perl soap client access the show_tables method below? Also
              >
              > how
              >
              > > would you pass username and password to the new method. For instance,
              > > using
              > >
              > > a couple elements in the soap header?
              > >
              > > #!/usr/bin/perl
              > >
              > > use SOAP::Transport::HTTP;
              > > use DBI;
              > >
              > > SOAP::Transport::HTTP::CGI->dispatch_to('DB::mysql')->handle;
              > >
              > > package DB::mysql;
              > >
              > > sub new {
              > > my($class,%args) = @_;
              > > my $self = {};
              > > bless $self, $class;
              > >
              > > $args{'user'} ||= 'root';
              > > $args{'pass'} || ='password';
              > >
              > > my $dsn = "DBI:mysql:database=mysql;host=127.0.0.1;port=3306";
              > > my $dbh = DBI->connect($dsn,$args{'user'},$args{'pass'});
              > >
              > > $self->{'dbh'} = $dbh;
              > > return $self;
              > > }
              > >
              > > sub show_tables {
              > > my($self,$database) = @_;
              > > my $dbh = $self->{'dbh'};
              > > my @tables;
              > >
              > >
              > > $dbh->do("use $database");
              > > my $sth = $dbh->prepare("show tables");
              > > $sth->execute();
              > > while(my $table = $sth->fetchrow_array()) {
              > > push(@tables, $table);
              > > }
              > > return @tables;
              > > }
              > >
              > >
            • Paul Kulchenko
              Hi Jason, I guess there are several points that have to be clarified. First of all, SOAP::Lite converts module names into URIs simply converting :: into / .
              Message 6 of 10 , Nov 24, 2002
              • 0 Attachment
                Hi Jason,

                I guess there are several points that have to be clarified.

                First of all, SOAP::Lite converts module names into URIs simply
                converting '::' into '/'. From DB::mysql you'll get DB/mysql. Other
                methods can be used in future versions (SOAP1.2 specification
                describes mapping from language specific names into XML), but
                compatibility will be preserved when possible.

                Second, PATH is extracted on server side and converted into package
                name using the same rule. It is possible thought to bind ANY URL into
                ANY package using dispatch_with() method instead of dispatch_to().

                Third, similar logic is used on the client side, however, one
                significant difference exists. When you use non-autodispatch mode and
                specify namespace using uri() method it is always transferred as it
                is (without any modifications). When you use autodispatch method, the
                PATH element of specified namespace is ignored and generated based on
                class/object name you're using, thus allowing you to call A->foo(),
                and B->bar() without need to call uri() method.

                In the example below:

                use SOAP::Lite
                ...
                uri => 'http://www.soaplite.com/Temperatures';
                # uri => 'http://www.soaplite.com/Foo';
                # uri => 'http://www.soaplite.com/';

                Temperatures->new()

                will all have the same result. The host element is NOT ignored and is
                used to generate a proper name
                ('http://www.soaplite.com/Temperatures' in this example)

                If you use A::B->foobar() then 'http://www.soaplite.com/A/B' URL will
                be generated.

                Forth, the example you showed in your first message won't work, but
                because of a different reason. In your new() method wou're trying to
                return a database handler which can't be properly serialized. You may
                need to do it little bit differently: you can either generate your
                handler and keep it on server side storing only id in your object; or
                you can use objects_by_reference features which does essentially the
                same, but doesn't require any custom coding. You just need to specify
                that any object of class Foo has to be return as reference and
                SOAP::Lite will do the rest (it'll store the original instance,
                provide dummy instance, bless it into the right class on server side,
                so you can call methods as usually, and will substitute dummy
                instance with original object when passed back on server side). See
                OBJECTS-BY-REFERENCE section
                (http://theoryx5.uwinnipeg.ca/CPAN/data/SOAP-Lite/SOAP/Lite.html#OBJECTS-BY-REFERENCE)
                and examples for more details.

                Let me know if it doesn't give you enough information.

                Best wishes, Paul.

                --- Jason Yates <jaywhy2@...> wrote:
                > Thanks for responding.
                >
                > I think you misunderstood my question. I'm didn't have any trouble
                >
                > understanding your example client, other then the fact of being
                > confused on
                > how you came up with a urn of ShowTables.
                >
                > The method call below, in your example client, will not work
                > properly because
                > you haven't created the DB::mysql object yet using the new
                > function.
                >
                > $soap->show_tables("mydb"); <-wont' work...
                >
                > This is where I was confused. The OO example given in the
                > SOAP::Lite
                > documentation doesn't really shed much light.
                >
                > use SOAP::Lite +autodispatch =>
                > uri => http://www.soaplite.com/Temperatures,
                > proxy => http://services.soaplite.com/temper.cgi;
                >
                > my $temperatures = Temperatures->new(32); # get object
                > print $temperatures->as_celsius; # invoke method
                >
                > Temperatures is the package, method calls are autodispatched to the
                > soap
                > service using the UNIVERSAL::AUTOLOAD module. The example above
                > won't work
                > with my package.
                >
                > use SOAP::Lite +autodispatch =>
                > uri => http://www.soaplite.com/DB::mysql, <-----not a
                > valid URI
                > proxy => http://services.soaplite.com/temper.cgi;
                >
                > my $temperatures = DB::mysql->new(32); <-----Can't be
                > autloaded.
                > print $temperatures->as_celsius; # invoke method
                >
                > The package name DB::mysql is an exact package location perse,
                > because of the
                > the "::". Therefore perl will look for the package DB::mysql in
                > the paths
                > listed in the @INC variable, and not get autoloaded by the
                > SOAP::Lite module.
                >
                >
                > Jason Yates
                >
                >
                > On Friday 22 November 2002 12:39, Byrne Reese wrote:
                > > ------_=_NextPart_001_01C2924E.1E1C49F0
                > > Content-Type: text/plain;
                > > charset="iso-8859-1"
                > >
                > > urn:ShowTables is completely arbitrary - it is just a namespace.
                > Ok, so let
                > > me break down my example client a bit more...
                > >
                > > > #!/usr/bin/perl -w
                > > > ###################################################
                > > > use SOAP::Lite; # +trace => qw(debug transport);
                > > > $HOST = ' <http://url/showtables.cgi';>
                > http://URL/showtables.cgi';
                > > > $NS = "urn:ShowTables";
                > >
                > > The host and ns are for you to configure. The host is the URL to
                > post your
                > > request to. The namespace must correspond to the namespace
                > declaration of
                > > the service you are invoking.
                > >
                > > > ###################################################
                > > > # DO NOT EDIT ANYTHING BELOW THIS LINE #
                > > > ###################################################
                > > > use Getopt::Long;
                > > > use Pod::Usage;
                > > > my $help = 0;
                > > > $result = GetOptions ('help|?' => \$help,
                > > > "username=s" => \$USERNAME,
                > > > "password=s" => \$PASSWORD)
                > > > or pod2usage(2);
                > > > my $DATABASE = $ARGV[0];
                > > > pod2usage(1) if $help || !$USERNAME || !$PASSWORD ||
                > !$DATABASE;
                > > > ###################################################
                > >
                > > This is just handy stuff I do for the command line. It makes
                > printing a
                > > usage statement really easy, especially if you have Perl POD
                > documentation
                > > embedded in your script... In any event, this is how the username
                > and
                > > password for the database is passed in. In you server example you
                > hard code
                > > the username and password, which is fine, but if you wanted to
                > add an
                > > additional layer of security, this might be how you do it.
                > >
                > > > my $soap = SOAP::Lite
                > > > ->readable(1)
                > > > ->uri($NS)
                > > > ->proxy($HOST);
                > >
                > > Ok, here is the meat. All we are doing here is creating a client
                > instance
                > > of SOAP::Lite. No calls have been made yet. All you are saying is
                > that you
                > > want to XML to be "readable", you specify the namespace, and URL
                > to connect
                > > with.
                > >
                > > > ### Of course I am adding the username and password as
                > arguments... you
                > > > ### don't need them for the implementation you have
                > > > ### below.
                > > > my $som = $soap->show_tables($USERNAME,$PASSWORD,$DATABASE);
                > >
                > > Here you actually make your call to the remote service. What is
                > really cool
                > > about SOAP::Lite is how it serializes and deserializes the method
                > call for
                > > you. For example, you identified the service above with the
                > "->proxy()"
                > > call. Now, if you want to send a request to that service and
                > invoke a
                > > method (or I should say subroutine) called "invoke_me_now()" then
                > simply
                > > invoke that method as if it were a member of the SOAP::Lite
                > instance we
                > > just created.
                > >
                > > So, your CGI has a method called show_tables($db) - just say:
                > > $soap->show_tables("mydb");
                > > And you will call the remote method. Done and done.
                > >
                > > Now a SOAP::SOM object is returned. To access elements in the
                > SOAP::SOM
                > > object, let me direct you to the following client example I wrote
                > for the
                > > Amazon Web service:
                > >
                > > <http://majordojo.com/amazon_query/client.php>
                > > http://majordojo.com/amazon_query/client.php
                > >
                > > > print "The response from the server was:\n".$som->result."\n";
                > > >
                > > > 1;
                > >
                > > I always end my perl programs with a 1; so that I am assured that
                > 1 is
                > > returned by the program when finished... it is just a style
                > thing. :-/
                > >
                > > Let me know if you have further questions, I would be happy to
                > help.
                > >
                > >
                > >
                > > -----Original Message-----
                > > From: Jason Yates [mailto:jaywhy2@...]
                > > Sent: Friday, November 22, 2002 9:20 AM
                > > To: Byrne Reese; soaplite@yahoogroups.com
                > > Subject: Re: [soaplite] little confused
                > >
                > >
                > > Thanks for the reply, but I'm still lost. Where did you get the
                > urn
                > > "ShowTables"? Also I'm looking more for dispatching a OO type
                > module. How
                > > would I call the new function?
                > >
                > > I've noticed you can autodispatch modules. For example,
                > >
                > > use SOAP::Lite +autodispatch =>
                > > uri => ' http://www.soaplite.com/Temperatures',
                > > <http://www.soaplite.com/Temperatures',>
                > > proxy => ' http://services.soaplite.com/temper.cgi';
                > > <http://services.soaplite.com/temper.cgi';>
                > > my $temperatures = Temperatures->new(32);
                > > print $temperatures->as_celsius;
                > >
                > > The problem with the fictional module DB::mysql is it's an exact
                > package
                > > name,
                > > unlike Temperatures which can be Autoloaded. Nor is DB::mysql a
                > > suspectible
                > >
                > > uri.
                > >
                > > my $soap = SOAP::Lite
                > > ->uri(' http://127.0.0.1/DB::mysql')
                > <http://127.0.0.1/DB::mysql')>
                > > ->proxy(' http://127.0.0.1/cgi-bin/db.cgi');
                > > <http://127.0.0.1/cgi-bin/db.cgi');>
                > >
                > > Just doesn't work.
                > >
                > >
                >
                === message truncated ===


                __________________________________________________
                Do you Yahoo!?
                Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
                http://mailplus.yahoo.com
              • Jason Yates
                Thanks a lot. I understand a lot better now. Probably should have read the SOAP::Lite documentation a little closer, and could have saved myself a lot of
                Message 7 of 10 , Nov 25, 2002
                • 0 Attachment
                  Thanks a lot. I understand a lot better now. Probably should have read the
                  SOAP::Lite documentation a little closer, and could have saved myself a lot
                  of trouble.

                  I have one more problem though, with the autodispatch feature. =/

                  Below is the code for the server and client.

                  server:
                  #!/usr/bin/perl

                  use SOAP::Transport::HTTP;

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

                  package Temperatures;

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

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

                  client:
                  use SOAP::Lite +autodispatch =>
                  uri => 'http://www.soaplite.com/Temperatures',
                  proxy => 'http://127.0.0.1/cgi-bin/temp.cgi';

                  my $temperatures = Temperatures->new(100);
                  print $temperatures->as_fahrenheit;


                  The server and client come directly from the book "SOAP: Cross Platform Web
                  Service Development Using XML". The server works when using the SOAP::Lite
                  call() function. But after changing the client to work with autodispatch,
                  I'm getting this perl error.

                  Can't locate object method "new" via package "Temperatures" (perhaps you
                  forgot to load "Temperatures"?) at temp.pl line 7.

                  It looks like it's not autoloading properly, but I don't see anything wrong
                  with the syntax. Any ideas?

                  Jason Yates

                  On Sunday 24 November 2002 22:00, you wrote:
                  > Hi Jason,
                  >
                  > I guess there are several points that have to be clarified.
                  >
                  > First of all, SOAP::Lite converts module names into URIs simply
                  > converting '::' into '/'. From DB::mysql you'll get DB/mysql. Other
                  > methods can be used in future versions (SOAP1.2 specification
                  > describes mapping from language specific names into XML), but
                  > compatibility will be preserved when possible.
                  >
                  > Second, PATH is extracted on server side and converted into package
                  > name using the same rule. It is possible thought to bind ANY URL into
                  > ANY package using dispatch_with() method instead of dispatch_to().
                  >
                  > Third, similar logic is used on the client side, however, one
                  > significant difference exists. When you use non-autodispatch mode and
                  > specify namespace using uri() method it is always transferred as it
                  > is (without any modifications). When you use autodispatch method, the
                  > PATH element of specified namespace is ignored and generated based on
                  > class/object name you're using, thus allowing you to call A->foo(),
                  > and B->bar() without need to call uri() method.
                  >
                  > In the example below:
                  >
                  > use SOAP::Lite
                  > ...
                  > uri => 'http://www.soaplite.com/Temperatures';
                  > # uri => 'http://www.soaplite.com/Foo';
                  > # uri => 'http://www.soaplite.com/';
                  >
                  > Temperatures->new()
                  >
                  > will all have the same result. The host element is NOT ignored and is
                  > used to generate a proper name
                  > ('http://www.soaplite.com/Temperatures' in this example)
                  >
                  > If you use A::B->foobar() then 'http://www.soaplite.com/A/B' URL will
                  > be generated.
                  >
                  > Forth, the example you showed in your first message won't work, but
                  > because of a different reason. In your new() method wou're trying to
                  > return a database handler which can't be properly serialized. You may
                  > need to do it little bit differently: you can either generate your
                  > handler and keep it on server side storing only id in your object; or
                  > you can use objects_by_reference features which does essentially the
                  > same, but doesn't require any custom coding. You just need to specify
                  > that any object of class Foo has to be return as reference and
                  > SOAP::Lite will do the rest (it'll store the original instance,
                  > provide dummy instance, bless it into the right class on server side,
                  > so you can call methods as usually, and will substitute dummy
                  > instance with original object when passed back on server side). See
                  > OBJECTS-BY-REFERENCE section
                  > (http://theoryx5.uwinnipeg.ca/CPAN/data/SOAP-Lite/SOAP/Lite.html#OBJECTS-BY
                  >-REFERENCE) and examples for more details.
                  >
                  > Let me know if it doesn't give you enough information.
                  >
                  > Best wishes, Paul.
                • Paul Kulchenko
                  Hi Jason, ... I don t see anything wrong with the code either and you shouldn t have this error unless you re using Perl 5.8.0 that has bug in
                  Message 8 of 10 , Nov 25, 2002
                  • 0 Attachment
                    Hi Jason,

                    > Can't locate object method "new" via package "Temperatures"
                    > (perhaps you
                    > forgot to load "Temperatures"?) at temp.pl line 7.
                    >
                    > It looks like it's not autoloading properly, but I don't see
                    > anything wrong with the syntax. Any ideas?

                    I don't see anything wrong with the code either and you shouldn't
                    have this error unless you're using Perl 5.8.0 that has bug in
                    UNIVERSAL::AUTOLOAD handling. You need to either use dispatch_from
                    instead of autodispatch or insert "{package Temperatures}" somewhere
                    in your code. Let me know if it's something else.

                    Best wishes, Paul.

                    --- Jason Yates <jaywhy2@...> wrote:
                    > Thanks a lot. I understand a lot better now. Probably should have
                    > read the
                    > SOAP::Lite documentation a little closer, and could have saved
                    > myself a lot
                    > of trouble.
                    >
                    > I have one more problem though, with the autodispatch feature. =/
                    >
                    > Below is the code for the server and client.
                    >
                    > server:
                    > #!/usr/bin/perl
                    >
                    > use SOAP::Transport::HTTP;
                    >
                    > SOAP::Transport::HTTP::CGI->dispatch_to('Temperatures')->handle;
                    >
                    > package Temperatures;
                    >
                    > sub new {
                    > my $self = shift;
                    > my $class = ref($self) || $self;
                    > bless {_temperature => shift} => $class;
                    > }
                    >
                    > sub as_fahrenheit {
                    > return shift->{_temperature};
                    > }
                    >
                    > client:
                    > use SOAP::Lite +autodispatch =>
                    > uri => 'http://www.soaplite.com/Temperatures',
                    > proxy => 'http://127.0.0.1/cgi-bin/temp.cgi';
                    >
                    > my $temperatures = Temperatures->new(100);
                    > print $temperatures->as_fahrenheit;
                    >
                    >
                    > The server and client come directly from the book "SOAP: Cross
                    > Platform Web
                    > Service Development Using XML". The server works when using the
                    > SOAP::Lite
                    > call() function. But after changing the client to work with
                    > autodispatch,
                    > I'm getting this perl error.
                    >
                    > Can't locate object method "new" via package "Temperatures"
                    > (perhaps you
                    > forgot to load "Temperatures"?) at temp.pl line 7.
                    >
                    > It looks like it's not autoloading properly, but I don't see
                    > anything wrong
                    > with the syntax. Any ideas?
                    >
                    > Jason Yates
                    >
                    > On Sunday 24 November 2002 22:00, you wrote:
                    > > Hi Jason,
                    > >
                    > > I guess there are several points that have to be clarified.
                    > >
                    > > First of all, SOAP::Lite converts module names into URIs simply
                    > > converting '::' into '/'. From DB::mysql you'll get DB/mysql.
                    > Other
                    > > methods can be used in future versions (SOAP1.2 specification
                    > > describes mapping from language specific names into XML), but
                    > > compatibility will be preserved when possible.
                    > >
                    > > Second, PATH is extracted on server side and converted into
                    > package
                    > > name using the same rule. It is possible thought to bind ANY URL
                    > into
                    > > ANY package using dispatch_with() method instead of
                    > dispatch_to().
                    > >
                    > > Third, similar logic is used on the client side, however, one
                    > > significant difference exists. When you use non-autodispatch mode
                    > and
                    > > specify namespace using uri() method it is always transferred as
                    > it
                    > > is (without any modifications). When you use autodispatch method,
                    > the
                    > > PATH element of specified namespace is ignored and generated
                    > based on
                    > > class/object name you're using, thus allowing you to call
                    > A->foo(),
                    > > and B->bar() without need to call uri() method.
                    > >
                    > > In the example below:
                    > >
                    > > use SOAP::Lite
                    > > ...
                    > > uri => 'http://www.soaplite.com/Temperatures';
                    > > # uri => 'http://www.soaplite.com/Foo';
                    > > # uri => 'http://www.soaplite.com/';
                    > >
                    > > Temperatures->new()
                    > >
                    > > will all have the same result. The host element is NOT ignored
                    > and is
                    > > used to generate a proper name
                    > > ('http://www.soaplite.com/Temperatures' in this example)
                    > >
                    > > If you use A::B->foobar() then 'http://www.soaplite.com/A/B' URL
                    > will
                    > > be generated.
                    > >
                    > > Forth, the example you showed in your first message won't work,
                    > but
                    > > because of a different reason. In your new() method wou're trying
                    > to
                    > > return a database handler which can't be properly serialized. You
                    > may
                    > > need to do it little bit differently: you can either generate
                    > your
                    > > handler and keep it on server side storing only id in your
                    > object; or
                    > > you can use objects_by_reference features which does essentially
                    > the
                    > > same, but doesn't require any custom coding. You just need to
                    > specify
                    > > that any object of class Foo has to be return as reference and
                    > > SOAP::Lite will do the rest (it'll store the original instance,
                    > > provide dummy instance, bless it into the right class on server
                    > side,
                    > > so you can call methods as usually, and will substitute dummy
                    > > instance with original object when passed back on server side).
                    > See
                    > > OBJECTS-BY-REFERENCE section
                    > >
                    >
                    (http://theoryx5.uwinnipeg.ca/CPAN/data/SOAP-Lite/SOAP/Lite.html#OBJECTS-BY
                    > >-REFERENCE) and examples for more details.
                    > >
                    > > Let me know if it doesn't give you enough information.
                    > >
                    > > Best wishes, Paul.


                    __________________________________________________
                    Do you Yahoo!?
                    Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
                    http://mailplus.yahoo.com
                  • Jason Yates
                    I m using perl 5.8. But it works perfectly fine using dispatch_from. Thanks. Jason Yates
                    Message 9 of 10 , Nov 25, 2002
                    • 0 Attachment
                      I'm using perl 5.8. But it works perfectly fine using dispatch_from. Thanks.

                      Jason Yates

                      On Monday 25 November 2002 14:16, Paul Kulchenko wrote:
                      > Hi Jason,
                      >
                      > > Can't locate object method "new" via package "Temperatures"
                      > > (perhaps you
                      > > forgot to load "Temperatures"?) at temp.pl line 7.
                      > >
                      > > It looks like it's not autoloading properly, but I don't see
                      > > anything wrong with the syntax. Any ideas?
                      >
                      > I don't see anything wrong with the code either and you shouldn't
                      > have this error unless you're using Perl 5.8.0 that has bug in
                      > UNIVERSAL::AUTOLOAD handling. You need to either use dispatch_from
                      > instead of autodispatch or insert "{package Temperatures}" somewhere
                      > in your code. Let me know if it's something else.
                      >
                      > Best wishes, Paul.
                      >
                      > --- Jason Yates <jaywhy2@...> wrote:
                      > > Thanks a lot. I understand a lot better now. Probably should have
                      > > read the
                      > > SOAP::Lite documentation a little closer, and could have saved
                      > > myself a lot
                      > > of trouble.
                      > >
                      > > I have one more problem though, with the autodispatch feature. =/
                      > >
                      > > Below is the code for the server and client.
                      > >
                      > > server:
                      > > #!/usr/bin/perl
                      > >
                      > > use SOAP::Transport::HTTP;
                      > >
                      > > SOAP::Transport::HTTP::CGI->dispatch_to('Temperatures')->handle;
                      > >
                      > > package Temperatures;
                      > >
                      > > sub new {
                      > > my $self = shift;
                      > > my $class = ref($self) || $self;
                      > > bless {_temperature => shift} => $class;
                      > > }
                      > >
                      > > sub as_fahrenheit {
                      > > return shift->{_temperature};
                      > > }
                      > >
                      > > client:
                      > > use SOAP::Lite +autodispatch =>
                      > > uri => 'http://www.soaplite.com/Temperatures',
                      > > proxy => 'http://127.0.0.1/cgi-bin/temp.cgi';
                      > >
                      > > my $temperatures = Temperatures->new(100);
                      > > print $temperatures->as_fahrenheit;
                      > >
                      > >
                      > > The server and client come directly from the book "SOAP: Cross
                      > > Platform Web
                      > > Service Development Using XML". The server works when using the
                      > > SOAP::Lite
                      > > call() function. But after changing the client to work with
                      > > autodispatch,
                      > > I'm getting this perl error.
                      > >
                      > > Can't locate object method "new" via package "Temperatures"
                      > > (perhaps you
                      > > forgot to load "Temperatures"?) at temp.pl line 7.
                      > >
                      > > It looks like it's not autoloading properly, but I don't see
                      > > anything wrong
                      > > with the syntax. Any ideas?
                      > >
                      > > Jason Yates
                      > >
                      > > On Sunday 24 November 2002 22:00, you wrote:
                      > > > Hi Jason,
                      > > >
                      > > > I guess there are several points that have to be clarified.
                      > > >
                      > > > First of all, SOAP::Lite converts module names into URIs simply
                      > > > converting '::' into '/'. From DB::mysql you'll get DB/mysql.
                      > >
                      > > Other
                      > >
                      > > > methods can be used in future versions (SOAP1.2 specification
                      > > > describes mapping from language specific names into XML), but
                      > > > compatibility will be preserved when possible.
                      > > >
                      > > > Second, PATH is extracted on server side and converted into
                      > >
                      > > package
                      > >
                      > > > name using the same rule. It is possible thought to bind ANY URL
                      > >
                      > > into
                      > >
                      > > > ANY package using dispatch_with() method instead of
                      > >
                      > > dispatch_to().
                      > >
                      > > > Third, similar logic is used on the client side, however, one
                      > > > significant difference exists. When you use non-autodispatch mode
                      > >
                      > > and
                      > >
                      > > > specify namespace using uri() method it is always transferred as
                      > >
                      > > it
                      > >
                      > > > is (without any modifications). When you use autodispatch method,
                      > >
                      > > the
                      > >
                      > > > PATH element of specified namespace is ignored and generated
                      > >
                      > > based on
                      > >
                      > > > class/object name you're using, thus allowing you to call
                      > >
                      > > A->foo(),
                      > >
                      > > > and B->bar() without need to call uri() method.
                      > > >
                      > > > In the example below:
                      > > >
                      > > > use SOAP::Lite
                      > > > ...
                      > > > uri => 'http://www.soaplite.com/Temperatures';
                      > > > # uri => 'http://www.soaplite.com/Foo';
                      > > > # uri => 'http://www.soaplite.com/';
                      > > >
                      > > > Temperatures->new()
                      > > >
                      > > > will all have the same result. The host element is NOT ignored
                      > >
                      > > and is
                      > >
                      > > > used to generate a proper name
                      > > > ('http://www.soaplite.com/Temperatures' in this example)
                      > > >
                      > > > If you use A::B->foobar() then 'http://www.soaplite.com/A/B' URL
                      > >
                      > > will
                      > >
                      > > > be generated.
                      > > >
                      > > > Forth, the example you showed in your first message won't work,
                      > >
                      > > but
                      > >
                      > > > because of a different reason. In your new() method wou're trying
                      > >
                      > > to
                      > >
                      > > > return a database handler which can't be properly serialized. You
                      > >
                      > > may
                      > >
                      > > > need to do it little bit differently: you can either generate
                      > >
                      > > your
                      > >
                      > > > handler and keep it on server side storing only id in your
                      > >
                      > > object; or
                      > >
                      > > > you can use objects_by_reference features which does essentially
                      > >
                      > > the
                      > >
                      > > > same, but doesn't require any custom coding. You just need to
                      > >
                      > > specify
                      > >
                      > > > that any object of class Foo has to be return as reference and
                      > > > SOAP::Lite will do the rest (it'll store the original instance,
                      > > > provide dummy instance, bless it into the right class on server
                      > >
                      > > side,
                      > >
                      > > > so you can call methods as usually, and will substitute dummy
                      > > > instance with original object when passed back on server side).
                      > >
                      > > See
                      > >
                      > > > OBJECTS-BY-REFERENCE section
                      >
                      > (http://theoryx5.uwinnipeg.ca/CPAN/data/SOAP-Lite/SOAP/Lite.html#OBJECTS-BY
                      >
                      > > >-REFERENCE) and examples for more details.
                      > > >
                      > > > Let me know if it doesn't give you enough information.
                      > > >
                      > > > Best wishes, Paul.
                      >
                      > __________________________________________________
                      > Do you Yahoo!?
                      > Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
                      > http://mailplus.yahoo.com
                    • Paul Kulchenko
                      Hi Jason, ... Yes, it does. dispatch_from uses AUTOLOAD for a specific package, whereas autodispatch uses UNIVERSAL::AUTOLOAD. The bug in 5.8 is in
                      Message 10 of 10 , Nov 25, 2002
                      • 0 Attachment
                        Hi Jason,

                        --- Jason Yates <jaywhy2@...> wrote:
                        > I'm using perl 5.8. But it works perfectly fine using
                        > dispatch_from. Thanks.
                        Yes, it does. dispatch_from uses AUTOLOAD for a specific package,
                        whereas autodispatch uses UNIVERSAL::AUTOLOAD. The bug in 5.8 is in
                        UNIVERSAL::AUTOLOAD handling only (it loads a method, but not a
                        package; you need to include "package Foo" declaration yourself to
                        make it work).

                        Best wishes, Paul.


                        __________________________________________________
                        Do you Yahoo!?
                        Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
                        http://mailplus.yahoo.com
                      Your message has been successfully submitted and would be delivered to recipients shortly.