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

RE: SOAP: Fault handling

Expand Messages
  • Garrett Goebel
    How can I have a server side function set related fault information returned to the client? Assume the client has a global fault handler which per the guide
    Message 1 of 13 , May 2, 2001
    • 0 Attachment
      RE: SOAP: Fault handling

      How can I have a server side function set related fault
      information returned to the client?

      Assume the client has a global fault handler which per the
      guide will "return undef and setup $! on failure". I.e.:

      use SOAP::Lite
        on_fault => sub {
          my($soap, $res) = @_;
          eval {
            die ref $res
              ? $res->faultdetail
              : $soap->transport->status
          };
          return ref $res ? $res : new SOAP::SOM;
        };


      Toss in the following server side functions:

      sub boom   { die "big bad error" }
      sub kaboom { eval {boom}; defined $! && exit warn "kaboom: $!" }


      When invoked from the client:

      $soap->boom()->result();
      defined $! and print "boom: ", $!, "\n";

      $soap->kaboom()->result();
      defined $! and print "kaboom ", $!, "\n";


      I get the following STDOUT:

      > server.pl
      kaboom:  at ... line ...
      >

      > client.pl
      boom: Bad file descriptor
      Can't call method "result" on an undefined value at ... line ...
      >


      How do I set meaningful fault detail for the client?

      I'm assuming all the server functions are being eval'd so in
      order to short-circuit the execution of the server I must
      resort to <C>exit</C>.

      Any other tips or suggestions?

    • Paul Kulchenko
      Hi, Garrett! First of all, I updated guide with new examples, that fix couple of typos there ($! instead of $@ and faultdetail instead of faultstring). I also
      Message 2 of 13 , May 2, 2001
      • 0 Attachment
        Hi, Garrett!

        First of all, I updated guide with new examples, that fix couple of
        typos there ($! instead of $@ and faultdetail instead of
        faultstring). I also updated .zip and .tar.gz archives. Correct
        example on client side looks like:

        #!perl -w
        use SOAP::Lite
        on_fault => sub { my($soap, $res) = @_;
        eval { die ref $res ? $res->faultstring :
        $soap->transport->status };
        return ref $res ? $res : new SOAP::SOM;
        };

        my $soap = SOAP::Lite
        -> uri('http://www.soaplite.com/Temperatures')
        -> proxy('http://services.soaplite.com/temper.cgi');

        defined (my $temp = $soap->c2f(37.5)->result) or die;
        print $temp;

        On server side there is nothing special. If you want to return fault
        on client side you may simply die with message:

        die "Oops, this operation is not allowed\n";

        or use SOAP::Fault if you need more control over fault information:

        die SOAP::Fault->faulcode('Server.Authentication')
        ->faultstring('Wrong password');

        Take a look into examples/My/Parameters.pm for more information on
        die calls.

        Let me know if it doesn't help or you need more complex examples.

        Best wishes, Paul.

        --- Garrett Goebel <garrett@...> wrote:
        > How can I have a server side function set related fault
        > information returned to the client?
        >
        > Assume the client has a global fault handler which per the
        > guide will "return undef and setup $! on failure". I.e.:
        >
        > use SOAP::Lite
        > on_fault => sub {
        > my($soap, $res) = @_;
        > eval {
        > die ref $res
        > ? $res->faultdetail
        > : $soap->transport->status
        > };
        > return ref $res ? $res : new SOAP::SOM;
        > };
        >
        >
        > Toss in the following server side functions:
        >
        > sub boom { die "big bad error" }
        > sub kaboom { eval {boom}; defined $! && exit warn "kaboom: $!" }
        >
        >
        > When invoked from the client:
        >
        > $soap->boom()->result();
        > defined $! and print "boom: ", $!, "\n";
        >
        > $soap->kaboom()->result();
        > defined $! and print "kaboom ", $!, "\n";
        >
        >
        > I get the following STDOUT:
        >
        > > server.pl
        > kaboom: at ... line ...
        > >
        >
        > > client.pl
        > boom: Bad file descriptor
        > Can't call method "result" on an undefined value at ... line ...
        > >
        >
        >
        > How do I set meaningful fault detail for the client?
        >
        > I'm assuming all the server functions are being eval'd so in
        > order to short-circuit the execution of the server I must
        > resort to <C>exit</C>.
        >
        > Any other tips or suggestions?
        >


        __________________________________________________
        Do You Yahoo!?
        Yahoo! Auctions - buy the things you want at great prices
        http://auctions.yahoo.com/
      • Paul Kulchenko
        Hi, Garrett! First of all, I updated guide with new examples, that fix couple of typos there ($! instead of $@ and faultdetail instead of faultstring). I also
        Message 3 of 13 , May 2, 2001
        • 0 Attachment
          Hi, Garrett!

          First of all, I updated guide with new examples, that fix couple of
          typos there ($! instead of $@ and faultdetail instead of
          faultstring). I also updated .zip and .tar.gz archives. Correct
          example on client side looks like:

          #!perl -w
          use SOAP::Lite
          on_fault => sub { my($soap, $res) = @_;
          eval { die ref $res ? $res->faultstring :
          $soap->transport->status };
          return ref $res ? $res : new SOAP::SOM;
          };

          my $soap = SOAP::Lite
          -> uri('http://www.soaplite.com/Temperatures')
          -> proxy('http://services.soaplite.com/temper.cgi');

          defined (my $temp = $soap->c2f(37.5)->result) or die;
          print $temp;

          On server side there is nothing special. If you want to return fault
          on client side you may simply die with message:

          die "Oops, this operation is not allowed\n";

          or use SOAP::Fault if you need more control over fault information:

          die SOAP::Fault->faulcode('Server.Authentication')
          ->faultstring('Wrong password');

          Take a look into examples/My/Parameters.pm for more information on
          die calls.

          Let me know if it doesn't help or you need more complex examples.

          Best wishes, Paul.

          --- Garrett Goebel <garrett@...> wrote:
          > How can I have a server side function set related fault
          > information returned to the client?
          >
          > Assume the client has a global fault handler which per the
          > guide will "return undef and setup $! on failure". I.e.:
          >
          > use SOAP::Lite
          > on_fault => sub {
          > my($soap, $res) = @_;
          > eval {
          > die ref $res
          > ? $res->faultdetail
          > : $soap->transport->status
          > };
          > return ref $res ? $res : new SOAP::SOM;
          > };
          >
          >
          > Toss in the following server side functions:
          >
          > sub boom { die "big bad error" }
          > sub kaboom { eval {boom}; defined $! && exit warn "kaboom: $!" }
          >
          >
          > When invoked from the client:
          >
          > $soap->boom()->result();
          > defined $! and print "boom: ", $!, "\n";
          >
          > $soap->kaboom()->result();
          > defined $! and print "kaboom ", $!, "\n";
          >
          >
          > I get the following STDOUT:
          >
          > > server.pl
          > kaboom: at ... line ...
          > >
          >
          > > client.pl
          > boom: Bad file descriptor
          > Can't call method "result" on an undefined value at ... line ...
          > >
          >
          >
          > How do I set meaningful fault detail for the client?
          >
          > I'm assuming all the server functions are being eval'd so in
          > order to short-circuit the execution of the server I must
          > resort to <C>exit</C>.
          >
          > Any other tips or suggestions?
          >


          __________________________________________________
          Do You Yahoo!?
          Yahoo! Auctions - buy the things you want at great prices
          http://auctions.yahoo.com/
        • Craig Kelley
          Hello Again, I have my code working fine, but I was wondering why this specific example is wrong: --= Server =-- use strict; use SOAP::Transport::HTTP;
          Message 4 of 13 , May 2, 2001
          • 0 Attachment
            Hello Again,

            I have my code working fine, but I was wondering why this specific example
            is wrong:

            --= Server =--
            use strict;
            use SOAP::Transport::HTTP;

            $SIG{PIPE} = 'IGNORE';

            my $daemon = SOAP::Transport::HTTP::Daemon
            -> new (LocalPort => 1983)
            ->
            dispatch_to('/usr/local/home/ink/programming/pharmon/server/server_mods')
            ;

            print "Contact to SOAP server at ", $daemon->url, "\n";
            $daemon->handle;



            --= Client =--
            use strict;
            use Carp;

            my $uri = "http://localhost/";
            my $proxy = "http://localhost:1983/";

            use SOAP::Lite +autodispatch =>
            uri => $uri,
            proxy => $proxy,
            debug => sub { print @_; }
            ;



            The server works fine. The BEGIN{} for the SOAP::Lite client always dies
            with this error message:

            proxy: transport protocol not specified
            BEGIN failed--compilation aborted at ./client.pl line 22.

            I looked through the Lite.pm code and found that proxy() was being called
            with a single null parameter (which fired the error message). Going
            backwards from there seemed a bit daunting :)

            PS - When is the Perl SOAP::Lite book coming out? :)

            -Craig
          • Sean.Meisner@VerizonWireless.com
            Hi Craig, The use statement gets executed at compile time, before perl attempts to run the rest of the script, so $uri and $proxy in this code snippet are
            Message 5 of 13 , May 3, 2001
            • 0 Attachment
              Hi Craig,

              The "use" statement gets executed at compile time, before perl attempts
              to run the rest of the script, so $uri and $proxy in this code snippet are
              undefined when you try to "use SOAP::Lite ... " . Try putting the "use
              SOAP::Lite..."
              line into a string, and then eval() it, to force a delay of execution until
              after $uri
              and $proxy contain meaningful values.

              Cheers,

              Sean





              Craig Kelley <kellcrai@...> on 05/02/2001 11:46:02 PM

              Please respond to soaplite@yahoogroups.com



              To: soaplite@yahoogroups.com
              cc: (bcc: Sean Meisner/Great Lakes/AirTouch)
              bcc: Sean Meisner/Great Lakes/AirTouch

              Subject: [soaplite] One More Question





              Hello Again,

              I have my code working fine, but I was wondering why this specific example
              is wrong:

              --= Server =--
              use strict;
              use SOAP::Transport::HTTP;

              $SIG{PIPE} = 'IGNORE';

              my $daemon = SOAP::Transport::HTTP::Daemon
              -> new (LocalPort => 1983)
              ->
              dispatch_to('/usr/local/home/ink/programming/pharmon/server/server_mods')
              ;

              print "Contact to SOAP server at ", $daemon->url, "\n";
              $daemon->handle;



              --= Client =--
              use strict;
              use Carp;

              my $uri = "http://localhost/";
              my $proxy = "http://localhost:1983/";

              use SOAP::Lite +autodispatch =>
              uri => $uri,
              proxy => $proxy,
              debug => sub { print @_; }
              ;



              The server works fine. The BEGIN{} for the SOAP::Lite client always dies
              with this error message:

              proxy: transport protocol not specified
              BEGIN failed--compilation aborted at ./client.pl line 22.

              I looked through the Lite.pm code and found that proxy() was being called
              with a single null parameter (which fired the error message). Going
              backwards from there seemed a bit daunting :)

              PS - When is the Perl SOAP::Lite book coming out? :)

              -Craig



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



              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            • Michael Percy
              Also, if you put it in a big BEGIN block, like so: BEGIN { use strict; use Carp; my $uri = http://localhost/ ; my $proxy = http://localhost:1983/ ; use
              Message 6 of 13 , May 3, 2001
              • 0 Attachment
                Also, if you put it in a big BEGIN block, like so:

                BEGIN {
                use strict;
                use Carp;

                my $uri = "http://localhost/";
                my $proxy = "http://localhost:1983/";

                use SOAP::Lite +autodispatch =>
                uri => $uri,
                proxy => $proxy,
                debug => sub { print @_; }
                ;
                }

                It will do what you were expecting, and evaluate that whole block at compile
                time, before anything else is executed.

                HTH,
                Mike

                > -----Original Message-----
                > From: Sean.Meisner@...
                > [mailto:Sean.Meisner@...]
                > Sent: Thursday, May 03, 2001 6:18 AM
                > To: soaplite@yahoogroups.com
                > Subject: Re: [soaplite] One More Question
                >
                >
                >
                > Hi Craig,
                >
                > The "use" statement gets executed at compile time, before
                > perl attempts
                > to run the rest of the script, so $uri and $proxy in this
                > code snippet are
                > undefined when you try to "use SOAP::Lite ... " . Try
                > putting the "use
                > SOAP::Lite..."
                > line into a string, and then eval() it, to force a delay of
                > execution until
                > after $uri
                > and $proxy contain meaningful values.
                >
                > Cheers,
                >
                > Sean
                >
                >
                >
                >
                >
                > Craig Kelley <kellcrai@...> on 05/02/2001 11:46:02 PM
                >
                > Please respond to soaplite@yahoogroups.com
                >
                >
                >
                > To: soaplite@yahoogroups.com
                > cc: (bcc: Sean Meisner/Great Lakes/AirTouch)
                > bcc: Sean Meisner/Great Lakes/AirTouch
                >
                > Subject: [soaplite] One More Question
                >
                >
                >
                >
                >
                > Hello Again,
                >
                > I have my code working fine, but I was wondering why this
                > specific example
                > is wrong:
                >
                > --= Server =--
                > use strict;
                > use SOAP::Transport::HTTP;
                >
                > $SIG{PIPE} = 'IGNORE';
                >
                > my $daemon = SOAP::Transport::HTTP::Daemon
                > -> new (LocalPort => 1983)
                > ->
                > dispatch_to('/usr/local/home/ink/programming/pharmon/server/se
                > rver_mods')
                > ;
                >
                > print "Contact to SOAP server at ", $daemon->url, "\n";
                > $daemon->handle;
                >
                >
                >
                > --= Client =--
                > use strict;
                > use Carp;
                >
                > my $uri = "http://localhost/";
                > my $proxy = "http://localhost:1983/";
                >
                > use SOAP::Lite +autodispatch =>
                > uri => $uri,
                > proxy => $proxy,
                > debug => sub { print @_; }
                > ;
                >
                >
                >
                > The server works fine. The BEGIN{} for the SOAP::Lite client
                > always dies
                > with this error message:
                >
                > proxy: transport protocol not specified
                > BEGIN failed--compilation aborted at ./client.pl line 22.
                >
                > I looked through the Lite.pm code and found that proxy() was
                > being called
                > with a single null parameter (which fired the error message). Going
                > backwards from there seemed a bit daunting :)
                >
                > PS - When is the Perl SOAP::Lite book coming out? :)
                >
                > -Craig
                >
                >
                >
                > To unsubscribe from this group, send an email to:
                > soaplite-unsubscribe@yahoogroups.com
                >
                >
                >
                > Your use of Yahoo! Groups is subject to
                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 http://docs.yahoo.com/info/terms/
              • Paul Kulchenko
                Hi, Craig! ... Answer is simple. use code is executed during the COMPILE stage and value of $proxy (and $uri) variable is undefined. It WILL be defined
                Message 7 of 13 , May 4, 2001
                • 0 Attachment
                  Hi, Craig!

                  > my $uri = "http://localhost/";
                  > my $proxy = "http://localhost:1983/";
                  >
                  > use SOAP::Lite +autodispatch =>
                  > uri => $uri,
                  > proxy => $proxy,
                  > debug => sub { print @_; }
                  > ;
                  Answer is simple. 'use' code is executed during the COMPILE stage and
                  value of $proxy (and $uri) variable is undefined. It WILL be defined
                  during the EXECUTION phase, but use block alredy executed by that
                  time. You need to wrap it in BEGIN block:

                  BEGIN {
                  my $uri = "http://localhost/";
                  my $proxy = "http://localhost:1983/";

                  use SOAP::Lite +autodispatch =>
                  uri => $uri,
                  proxy => $proxy,
                  debug => sub { print @_; }
                  ;
                  }

                  or wrap 'use' in eval to delay execution:

                  my $uri = "http://localhost/";
                  my $proxy = "http://localhost:1983/";

                  eval q!
                  use SOAP::Lite +autodispatch =>
                  uri => $uri,
                  proxy => $proxy,
                  debug => sub { print @_; }
                  ;
                  1;
                  ! or die;

                  or write proxy => 'http://...';

                  Should help. Let me know if you have any other questions.

                  Best wishes, Paul.

                  --- Craig Kelley <kellcrai@...> wrote:
                  >
                  > Hello Again,
                  >
                  > I have my code working fine, but I was wondering why this specific
                  > example
                  > is wrong:
                  >
                  > --= Server =--
                  > use strict;
                  > use SOAP::Transport::HTTP;
                  >
                  > $SIG{PIPE} = 'IGNORE';
                  >
                  > my $daemon = SOAP::Transport::HTTP::Daemon
                  > -> new (LocalPort => 1983)
                  > ->
                  >
                  dispatch_to('/usr/local/home/ink/programming/pharmon/server/server_mods')
                  > ;
                  >
                  > print "Contact to SOAP server at ", $daemon->url, "\n";
                  > $daemon->handle;
                  >
                  >
                  >
                  > --= Client =--
                  > use strict;
                  > use Carp;
                  >
                  > my $uri = "http://localhost/";
                  > my $proxy = "http://localhost:1983/";
                  >
                  > use SOAP::Lite +autodispatch =>
                  > uri => $uri,
                  > proxy => $proxy,
                  > debug => sub { print @_; }
                  > ;
                  >
                  >
                  >
                  > The server works fine. The BEGIN{} for the SOAP::Lite client
                  > always dies
                  > with this error message:
                  >
                  > proxy: transport protocol not specified
                  > BEGIN failed--compilation aborted at ./client.pl line 22.
                  >
                  > I looked through the Lite.pm code and found that proxy() was being
                  > called
                  > with a single null parameter (which fired the error message).
                  > Going
                  > backwards from there seemed a bit daunting :)
                  >
                  > PS - When is the Perl SOAP::Lite book coming out? :)
                  >
                  > -Craig
                  >
                  >
                  >
                  > To unsubscribe from this group, send an email to:
                  > soaplite-unsubscribe@yahoogroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to
                  > http://docs.yahoo.com/info/terms/
                  >
                  >


                  __________________________________________________
                  Do You Yahoo!?
                  Yahoo! Auctions - buy the things you want at great prices
                  http://auctions.yahoo.com/
                • Arun Kumar U
                  ... That would be cool !! Regards, Arun
                  Message 8 of 13 , May 5, 2001
                  • 0 Attachment
                    > PS - When is the Perl SOAP::Lite book coming out? :)

                    That would be cool !!

                    Regards,
                    Arun
                  • Paul Kulchenko
                    Hi, Arun! ... SOAP::Lite in his book (should be published in July) and I m working on SOAP book with James Snell, but it s moving slowly, so no dates here. I
                    Message 9 of 13 , May 5, 2001
                    • 0 Attachment
                      Hi, Arun!

                      --- Arun Kumar U <u_arunkumar@...> wrote:
                      > > PS - When is the Perl SOAP::Lite book coming out? :)
                      > That would be cool !!
                      :)) not so soon. Scott Seely is planning to include appendix about
                      SOAP::Lite in his book (should be published in July) and I'm working
                      on SOAP book with James Snell, but it's moving slowly, so no dates
                      here. I continue to work on User guide and hope to publish FAQ soon,
                      definitely you'll have more sources for the information. Don't expect
                      to get time for (big) writing soon, unless everybody on soaplite list
                      decide to contribute couple of pages. Hm, doesn't seem to be daunting
                      task, does it :))? And I would apprecite if you let me know what
                      you'd like to see covered in details and it's not right now.

                      Best wishes, Paul.

                      __________________________________________________
                      Do You Yahoo!?
                      Yahoo! Auctions - buy the things you want at great prices
                      http://auctions.yahoo.com/
                    • Craig Kelley
                      ... Well, sign me up when you do! Thanks for all the help; SOAP::Lite is working like a champ. -- It won t be long before the CPU is a card in a slot on your
                      Message 10 of 13 , May 7, 2001
                      • 0 Attachment
                        On Sat, 5 May 2001, Paul Kulchenko wrote:

                        > Hi, Arun!
                        >
                        > --- Arun Kumar U <u_arunkumar@...> wrote:
                        > > > PS - When is the Perl SOAP::Lite book coming out? :)
                        > > That would be cool !!
                        > :)) not so soon. Scott Seely is planning to include appendix about
                        > SOAP::Lite in his book (should be published in July) and I'm working
                        > on SOAP book with James Snell, but it's moving slowly, so no dates
                        > here. I continue to work on User guide and hope to publish FAQ soon,
                        > definitely you'll have more sources for the information. Don't expect
                        > to get time for (big) writing soon, unless everybody on soaplite list
                        > decide to contribute couple of pages. Hm, doesn't seem to be daunting
                        > task, does it :))? And I would apprecite if you let me know what
                        > you'd like to see covered in details and it's not right now.

                        Well, sign me up when you do!

                        Thanks for all the help; SOAP::Lite is working like a champ.

                        --
                        It won't be long before the CPU is a card in a slot on your ATX videoboard
                        Craig Kelley -- kellcrai@...
                        http://www.isu.edu/~kellcrai finger ink@... for PGP block
                      • judson@mcs.anl.gov
                        Ok, this is so cool. I ve almost made everything work. But doing what this thread says hasn t worked for me. The code: use strict; use SOAP::Lite debug ; my
                        Message 11 of 13 , Sep 19 6:20 PM
                        • 0 Attachment
                          Ok, this is so cool. I've almost made everything work.

                          But doing what this thread says hasn't worked for me.

                          The code:

                          use strict;
                          use SOAP::Lite 'debug';

                          my ($uri);

                          BEGIN {
                          $uri = 'http://alchesay.mcs.anl.gov:1180/';

                          use SOAP::Lite +autodispatch =>
                          uri => $uri,
                          proxy => $uri,
                          debug => sub { print @_; }
                          ;
                          }

                          my $videoC = AccessGrid::Node::VideoControl->new();
                          print $videoC->killVideoApp();

                          exit 0

                          Still claims to fail with no transport specified. Ideas?

                          --Ivan













                          --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                          > Hi, Craig!
                          >
                          > > my $uri = "http://localhost/";
                          > > my $proxy = "http://localhost:1983/";
                          > >
                          > > use SOAP::Lite +autodispatch =>
                          > > uri => $uri,
                          > > proxy => $proxy,
                          > > debug => sub { print @_; }
                          > > ;
                          > Answer is simple. 'use' code is executed during the COMPILE stage
                          and
                          > value of $proxy (and $uri) variable is undefined. It WILL be defined
                          > during the EXECUTION phase, but use block alredy executed by that
                          > time. You need to wrap it in BEGIN block:
                          >
                          > BEGIN {
                          > my $uri = "http://localhost/";
                          > my $proxy = "http://localhost:1983/";
                          >
                          > use SOAP::Lite +autodispatch =>
                          > uri => $uri,
                          > proxy => $proxy,
                          > debug => sub { print @_; }
                          > ;
                          > }
                          >
                          > or wrap 'use' in eval to delay execution:
                          >
                          > my $uri = "http://localhost/";
                          > my $proxy = "http://localhost:1983/";
                          >
                          > eval q!
                          > use SOAP::Lite +autodispatch =>
                          > uri => $uri,
                          > proxy => $proxy,
                          > debug => sub { print @_; }
                          > ;
                          > 1;
                          > ! or die;
                          >
                          > or write proxy => 'http://...';
                          >
                          > Should help. Let me know if you have any other questions.
                          >
                          > Best wishes, Paul.
                          >
                          > --- Craig Kelley <kellcrai@i...> wrote:
                          > >
                          > > Hello Again,
                          > >
                          > > I have my code working fine, but I was wondering why this specific
                          > > example
                          > > is wrong:
                          > >
                          > > --= Server =--
                          > > use strict;
                          > > use SOAP::Transport::HTTP;
                          > >
                          > > $SIG{PIPE} = 'IGNORE';
                          > >
                          > > my $daemon = SOAP::Transport::HTTP::Daemon
                          > > -> new (LocalPort => 1983)
                          > > ->
                          > >
                          > dispatch_to
                          ('/usr/local/home/ink/programming/pharmon/server/server_mods')
                          > > ;
                          > >
                          > > print "Contact to SOAP server at ", $daemon->url, "\n";
                          > > $daemon->handle;
                          > >
                          > >
                          > >
                          > > --= Client =--
                          > > use strict;
                          > > use Carp;
                          > >
                          > > my $uri = "http://localhost/";
                          > > my $proxy = "http://localhost:1983/";
                          > >
                          > > use SOAP::Lite +autodispatch =>
                          > > uri => $uri,
                          > > proxy => $proxy,
                          > > debug => sub { print @_; }
                          > > ;
                          > >
                          > >
                          > >
                          > > The server works fine. The BEGIN{} for the SOAP::Lite client
                          > > always dies
                          > > with this error message:
                          > >
                          > > proxy: transport protocol not specified
                          > > BEGIN failed--compilation aborted at ./client.pl line 22.
                          > >
                          > > I looked through the Lite.pm code and found that proxy() was being
                          > > called
                          > > with a single null parameter (which fired the error message).
                          > > Going
                          > > backwards from there seemed a bit daunting :)
                          > >
                          > > PS - When is the Perl SOAP::Lite book coming out? :)
                          > >
                          > > -Craig
                          > >
                          > >
                          > >
                          > > To unsubscribe from this group, send an email to:
                          > > soaplite-unsubscribe@y...
                          > >
                          > >
                          > >
                          > > Your use of Yahoo! Groups is subject to
                          > > http://docs.yahoo.com/info/terms/
                          > >
                          > >
                          >
                          >
                          > __________________________________________________
                          > Do You Yahoo!?
                          > Yahoo! Auctions - buy the things you want at great prices
                          > http://auctions.yahoo.com/
                        • Paul Kulchenko
                          Hi, Ivan! ... That s the way Perl works. $uri is NOT defined when you call use SOAP::Lite .... . And here is why. BEGIN block is executed as soon as it s
                          Message 12 of 13 , Sep 19 6:59 PM
                          • 0 Attachment
                            Hi, Ivan!

                            > Still claims to fail with no transport specified. Ideas?
                            That's the way Perl works. $uri is NOT defined when you call 'use
                            SOAP::Lite ....'. And here is why. BEGIN block is executed as soon as
                            it's compiled. But it's NOT compiled yet, because 'use ...' is INSIDE
                            the block itself and since it also works as BEGIN it gets executed
                            BEFORE $uri assignment. Simple example:

                            BEGIN {
                            print 'A';

                            BEGIN { print 'B' }
                            }

                            print 'A' will be executed AFTER all of the outer begin is COMPILED,
                            but during this compilation will be executed inner BEGIN block, so
                            it'll print 'BA' instead of expected 'AB'. That's exactly what
                            hapenning here. 'use ...' is executed before $uri is set.

                            You need to do something like this:

                            use strict;
                            use SOAP::Lite 'autodispatch', 'debug';

                            my $uri = 'http://alchesay.mcs.anl.gov:1180/';
                            SOAP::Lite->self->uri($uri)->proxy($uri);

                            my $videoC = AccessGrid::Node::VideoControl->new();
                            print $videoC->killVideoApp();

                            SOAP::Lite->self returns SOAP::Lite object that is used with
                            autodispatch mode. You can get/set properties as with usual
                            SOAP::Lite object. Hope it helps.

                            Best wishes, Paul.

                            --- judson@... wrote:
                            > Ok, this is so cool. I've almost made everything work.
                            >
                            > But doing what this thread says hasn't worked for me.
                            >
                            > The code:
                            >
                            > use strict;
                            > use SOAP::Lite 'debug';
                            >
                            > my ($uri);
                            >
                            > BEGIN {
                            > $uri = 'http://alchesay.mcs.anl.gov:1180/';
                            >
                            > use SOAP::Lite +autodispatch =>
                            > uri => $uri,
                            > proxy => $uri,
                            > debug => sub { print @_; }
                            > ;
                            > }
                            >
                            > my $videoC = AccessGrid::Node::VideoControl->new();
                            > print $videoC->killVideoApp();
                            >
                            > exit 0
                            >
                            > Still claims to fail with no transport specified. Ideas?
                            >
                            > --Ivan
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                            > > Hi, Craig!
                            > >
                            > > > my $uri = "http://localhost/";
                            > > > my $proxy = "http://localhost:1983/";
                            > > >
                            > > > use SOAP::Lite +autodispatch =>
                            > > > uri => $uri,
                            > > > proxy => $proxy,
                            > > > debug => sub { print @_; }
                            > > > ;
                            > > Answer is simple. 'use' code is executed during the COMPILE stage
                            >
                            > and
                            > > value of $proxy (and $uri) variable is undefined. It WILL be
                            > defined
                            > > during the EXECUTION phase, but use block alredy executed by that
                            > > time. You need to wrap it in BEGIN block:
                            > >
                            > > BEGIN {
                            > > my $uri = "http://localhost/";
                            > > my $proxy = "http://localhost:1983/";
                            > >
                            > > use SOAP::Lite +autodispatch =>
                            > > uri => $uri,
                            > > proxy => $proxy,
                            > > debug => sub { print @_; }
                            > > ;
                            > > }
                            > >
                            > > or wrap 'use' in eval to delay execution:
                            > >
                            > > my $uri = "http://localhost/";
                            > > my $proxy = "http://localhost:1983/";
                            > >
                            > > eval q!
                            > > use SOAP::Lite +autodispatch =>
                            > > uri => $uri,
                            > > proxy => $proxy,
                            > > debug => sub { print @_; }
                            > > ;
                            > > 1;
                            > > ! or die;
                            > >
                            > > or write proxy => 'http://...';
                            > >
                            > > Should help. Let me know if you have any other questions.
                            > >
                            > > Best wishes, Paul.
                            > >
                            > > --- Craig Kelley <kellcrai@i...> wrote:
                            > > >
                            > > > Hello Again,
                            > > >
                            > > > I have my code working fine, but I was wondering why this
                            > specific
                            > > > example
                            > > > is wrong:
                            > > >
                            > > > --= Server =--
                            > > > use strict;
                            > > > use SOAP::Transport::HTTP;
                            > > >
                            > > > $SIG{PIPE} = 'IGNORE';
                            > > >
                            > > > my $daemon = SOAP::Transport::HTTP::Daemon
                            > > > -> new (LocalPort => 1983)
                            > > > ->
                            > > >
                            > > dispatch_to
                            > ('/usr/local/home/ink/programming/pharmon/server/server_mods')
                            > > > ;
                            > > >
                            > > > print "Contact to SOAP server at ", $daemon->url, "\n";
                            > > > $daemon->handle;
                            > > >
                            > > >
                            > > >
                            > > > --= Client =--
                            > > > use strict;
                            > > > use Carp;
                            > > >
                            > > > my $uri = "http://localhost/";
                            > > > my $proxy = "http://localhost:1983/";
                            > > >
                            > > > use SOAP::Lite +autodispatch =>
                            > > > uri => $uri,
                            > > > proxy => $proxy,
                            > > > debug => sub { print @_; }
                            > > > ;
                            > > >
                            > > >
                            > > >
                            > > > The server works fine. The BEGIN{} for the SOAP::Lite client
                            > > > always dies
                            > > > with this error message:
                            > > >
                            > > > proxy: transport protocol not specified
                            > > > BEGIN failed--compilation aborted at ./client.pl line 22.
                            > > >
                            > > > I looked through the Lite.pm code and found that proxy() was
                            > being
                            > > > called
                            > > > with a single null parameter (which fired the error message).
                            > > > Going
                            > > > backwards from there seemed a bit daunting :)
                            > > >
                            > > > PS - When is the Perl SOAP::Lite book coming out? :)
                            > > >
                            > > > -Craig
                            > > >
                            > > >
                            > > >
                            > > > To unsubscribe from this group, send an email to:
                            > > > soaplite-unsubscribe@y...
                            > > >
                            > > >
                            > > >
                            > > > Your use of Yahoo! Groups is subject to
                            > > > http://docs.yahoo.com/info/terms/
                            > > >
                            > > >
                            > >
                            > >
                            > > __________________________________________________
                            > > Do You Yahoo!?
                            > > Yahoo! Auctions - buy the things you want at great prices
                            > > http://auctions.yahoo.com/
                            >
                            >
                            > ------------------------ Yahoo! Groups Sponsor
                            >
                            > To unsubscribe from this group, send an email to:
                            > soaplite-unsubscribe@yahoogroups.com
                            >
                            >
                            >
                            > Your use of Yahoo! Groups is subject to
                            > http://docs.yahoo.com/info/terms/
                            >
                            >


                            __________________________________________________
                            Terrorist Attacks on U.S. - How can you help?
                            Donate cash, emergency relief information
                            http://dailynews.yahoo.com/fc/US/Emergency_Information/
                          • Chris Davies
                            Hi Rather than posting with a subject of one more question , etc., can you please consider using a descriptive subject related to your email. That way, when
                            Message 13 of 13 , Sep 20 2:10 AM
                            • 0 Attachment
                              Hi
                               
                              Rather than posting with a subject of "one more question", etc., can you please consider using a descriptive subject related to your email. That way, when someone searches the archives it's easier to see messages of interest.
                               
                              Cheers,
                              Chris
                               
                              -----Original Message-----
                              From: judson@... [mailto:judson@...]
                              Sent: Thursday, September 20, 2001 2:21 AM
                              To: soaplite@yahoogroups.com
                              Subject: [soaplite] Re: One More Question

                              Ok, this is so cool.  I've almost made everything work.

                              But doing what this thread says hasn't worked for me.

                              The code:

                              use strict;
                              use SOAP::Lite 'debug';

                              my ($uri);

                              BEGIN {
                                $uri = 'http://alchesay.mcs.anl.gov:1180/';

                                use SOAP::Lite +autodispatch =>
                                  uri => $uri,
                                  proxy => $uri,
                                  debug => sub { print @_; }
                                 ;
                              }

                              my $videoC = AccessGrid::Node::VideoControl->new();
                              print $videoC->killVideoApp();

                              exit 0

                              Still claims to fail with no transport specified.  Ideas?

                              --Ivan













                              --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                              > Hi, Craig!
                              >
                              > > my $uri = "http://localhost/";
                              > > my $proxy = "http://localhost:1983/";
                              > >
                              > > use SOAP::Lite +autodispatch =>
                              > >   uri => $uri,
                              > >   proxy => $proxy,
                              > >   debug => sub { print @_; }
                              > >   ;
                              > Answer is simple. 'use' code is executed during the COMPILE stage
                              and
                              > value of $proxy (and $uri) variable is undefined. It WILL be defined
                              > during the EXECUTION phase, but use block alredy executed by that
                              > time. You need to wrap it in BEGIN block:
                              >
                              > BEGIN {
                              >   my $uri = "http://localhost/";
                              >   my $proxy = "http://localhost:1983/";

                              >   use SOAP::Lite +autodispatch =>
                              >     uri => $uri,
                              >     proxy => $proxy,
                              >     debug => sub { print @_; }
                              >   ;
                              > }
                              >
                              > or wrap 'use' in eval to delay execution:
                              >
                              >   my $uri = "http://localhost/";
                              >   my $proxy = "http://localhost:1983/";
                              >
                              > eval q!
                              >   use SOAP::Lite +autodispatch =>
                              >     uri => $uri,
                              >     proxy => $proxy,
                              >     debug => sub { print @_; }
                              >   ;
                              >  1;
                              > ! or die;
                              >
                              > or write proxy => 'http://...';
                              >
                              > Should help. Let me know if you have any other questions.
                              >
                              > Best wishes, Paul.
                              >
                              > --- Craig Kelley <kellcrai@i...> wrote:
                              > >
                              > > Hello Again,
                              > >
                              > > I have my code working fine, but I was wondering why this specific
                              > > example
                              > > is wrong:
                              > >
                              > >  --= Server =--
                              > > use strict;
                              > > use SOAP::Transport::HTTP;
                              > >
                              > > $SIG{PIPE} = 'IGNORE';
                              > >
                              > > my $daemon = SOAP::Transport::HTTP::Daemon
                              > >     -> new (LocalPort => 1983)
                              > >     ->
                              > >
                              > dispatch_to
                              ('/usr/local/home/ink/programming/pharmon/server/server_mods')
                              > >   ;
                              > >
                              > > print "Contact to SOAP server at ", $daemon->url, "\n";
                              > >   $daemon->handle;
                              > >
                              > >
                              > >
                              > >  --= Client =--
                              > > use strict;
                              > > use Carp;
                              > >
                              > > my $uri = "http://localhost/";
                              > > my $proxy = "http://localhost:1983/";
                              > >
                              > > use SOAP::Lite +autodispatch =>
                              > >   uri => $uri,
                              > >   proxy => $proxy,
                              > >   debug => sub { print @_; }
                              > >   ;
                              > >
                              > >
                              > >
                              > > The server works fine.  The BEGIN{} for the SOAP::Lite client
                              > > always dies
                              > > with this error message:
                              > >
                              > > proxy: transport protocol not specified
                              > > BEGIN failed--compilation aborted at ./client.pl line 22.
                              > >
                              > > I looked through the Lite.pm code and found that proxy() was being
                              > > called
                              > > with a single null parameter (which fired the error message).
                              > > Going
                              > > backwards from there seemed a bit daunting :)
                              > >
                              > > PS - When is the Perl SOAP::Lite book coming out?  :)
                              > >
                              > >   -Craig
                              > >
                              > >
                              > >
                              > > To unsubscribe from this group, send an email to:
                              > > soaplite-unsubscribe@y...
                              > >
                              > > 
                              > >
                              > > Your use of Yahoo! Groups is subject to
                              > > http://docs.yahoo.com/info/terms/
                              > >
                              > >
                              >
                              >
                              > __________________________________________________
                              > Do You Yahoo!?
                              > Yahoo! Auctions - buy the things you want at great prices
                              > http://auctions.yahoo.com/



                              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.
                            Your message has been successfully submitted and would be delivered to recipients shortly.