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

Re: [soaplite] Uninitialized Value in SOAP::Lite

Expand Messages
  • Jo Rhett
    ... What is the difference between this line and the following? $self- on_action- ( $self- action, $method_uri, $method_name); Because the my $action
    Message 1 of 5 , Jul 13 11:46 AM
    • 0 Attachment
      On Jul 12, 2010, at 6:40 AM, Thomas Boyda wrote:
      > Use of uninitialized value $action in pattern match (m//) at
      > C:/Perl/site/lib/SOAP/Lite.pm line 2674.
      >
      > In the subroutine find_target $action is initialized here:
      >
      > $self->on_action->(my $action = $self->action, $method_uri, $method_name);

      What is the difference between this line and the following?

      $self->on_action->( $self->action, $method_uri, $method_name);

      Because the "my $action" wouldn't exist beyond the invocation of the call above. Context context context.

      And your code is either really confused, or you're not pasting enough of it for it to make sense. Paste the entire context.

      --
      Jo Rhett
      Net Consonance : consonant endings by net philanthropy, open source and other randomness
    • Thomas Boyda
      Jo, Thanks for the response. The code below is not mine it is in SOAP::Lite version 0.712 at line 2674. ... It is probably me that is confused. I am trying to
      Message 2 of 5 , Jul 13 12:13 PM
      • 0 Attachment
        Jo,

        Thanks for the response.

        The code below is not mine it is in SOAP::Lite version 0.712 at line 2674.

        On Tue, Jul 13, 2010 at 2:46 PM, Jo Rhett <jrhett@...> wrote:
        >
        > On Jul 12, 2010, at 6:40 AM, Thomas Boyda wrote:
        >> Use of uninitialized value $action in pattern match (m//) at
        >> C:/Perl/site/lib/SOAP/Lite.pm line 2674.
        >>
        >> In the subroutine find_target $action is initialized here:
        >>
        >> $self->on_action->(my $action = $self->action, $method_uri, $method_name);
        >
        > What is the difference between this line and the following?
        >
        >  $self->on_action->( $self->action, $method_uri, $method_name);
        >
        > Because the "my $action" wouldn't exist beyond the invocation of the call above.   Context context context.
        >
        > And your code is either really confused, or you're not pasting enough of it for it to make sense.  Paste the entire context.

        It is probably me that is confused. I am trying to send a XML document
        to my little SOAP::Lite server daemon but I am getting above error
        about the uninitialized value.

        Here is the SOAP:Lite server i wrote:

        #!/usr/bin/perl -w

        use strict;

        use SOAP::Lite +trace => qw(all);
        use SOAP::Transport::HTTP;
        use SOAP::Lite::Packager;
        use MIME::Entity;

        print "Starting daemon on port 8080\n";

        my $daemon = new SOAP::Transport::HTTP::Daemon (LocalPort => 8080);
        $daemon=$daemon->packager(SOAP::Lite::Packager::MIME->new);
        $daemon=$daemon->dispatch_to('LoadXML');
        print "Contact SOAP server at ", $daemon->url, "\n";
        $daemon->handle();

        BEGIN {
        package LoadXML;
        use vars qw(@ISA);
        @ISA = qw( Exporter SOAP::Server::Parameters);
        use SOAP::Lite;

        sub new {
        my $class = shift;
        my $self = {};
        return (bless ($self, $class));
        }

        sub loadxml {
        my $self = shift @_;
        my $envelope = pop;
        my $data = $_[0];
        print STDERR "In loadxml checking for
        attachment... \n";
        foreach my $part (@{$envelope->parts}){
        print STDERR
        "AttachmentService: attachment found! ".ref($part)."\n";
        print STDERR
        "AttachmentService: content length => ".length($part->stringify)."\n";
        print STDERR
        "AttachmentService: contents => ".$part->stringify."\n";
        }
        my $error;
        print STDERR "In loadxml... |".length($data)."|\n";
        my $rv = $self->upload('file_'.$$, $data);

        if ( $rv == 0 ) {
        $error = "";
        } else {
        $error = "File must be sent to this service";
        }
        return SOAP::Data->name('LoadXML' => "File recieved;
        File size = ".length($data));
        }

        sub upload {
        my $self = shift;
        my $file = shift;
        my $xml = shift;

        print STDERR "In upload... |".length($xml)."|\n";
        open( FILE, "> $file") || die "Couldn't open
        the file $file: $!\n";
        print FILE $xml;

        close FILE;

        return 0;
        }

        }

        1;



        --
        Tom.
        -----------
        Thomas Boyda
        thomas.boyda@...
      • Dave Howorth
        ... I don t believe you are thinking properly about Perl s scope rules. What does this code print? #!/usr/bin/perl use strict; use warnings; sub routine {
        Message 3 of 5 , Jul 14 2:47 AM
        • 0 Attachment
          Jo Rhett wrote:
          >> $self->on_action->(my $action = $self->action, $method_uri,
          >> $method_name);
          >
          > What is the difference between this line and the following?
          >
          > $self->on_action->( $self->action, $method_uri, $method_name);
          >
          > Because the "my $action" wouldn't exist beyond the invocation of the
          > call above. Context context context.

          I don't believe you are thinking properly about Perl's scope rules.
          What does this code print?

          #!/usr/bin/perl
          use strict;
          use warnings;

          sub routine {
          print "@_\n";
          }

          routine(my $action = 1, 2, 3);

          print $action, "\n";

          Hint: what's the definition of a block?

          Cheers, Dave
        • Thomas Boyda
          Dave, On Wed, Jul 14, 2010 at 8:52 AM, Dave Howorth ... I tend to agree that support for SOAP::Lite is patchy - I really like the interface it provides. I was
          Message 4 of 5 , Jul 14 6:17 AM
          • 0 Attachment
            Dave,

            On Wed, Jul 14, 2010 at 8:52 AM, Dave Howorth
            <dhoworth@...> wrote:
            >
            > Sorry but I don't have much experience with SOAP::Lite. Support seems
            > pretty patchy. When I was developing a simple program a couple of years
            > ago, I had to do a lot of my own digging into code that I'd rather hoped
            > would be a black box.
            >
            > There seems to be a lot more activity around XML::Compile but I've
            > absolutely no idea whether it even handles SOAP.
            >
            > But much as I like Perl, I suspect other languages are a better choice
            > for serious SOAP processing.

            I tend to agree that support for SOAP::Lite is patchy - I really like
            the interface it provides. I was thinking if there was an example of
            just pulling out the entire SOAP body without having to go through
            parsing, I could feed the XML Document to another routine to do the
            parsing.

            I have been trying to dig and debug the problem - but with little luck
            in finding a solution. I may have to bite the bullet and use something
            else. XML::Compile has a SOAP module and that may be a possibility. I
            would like to stay with perl if possible.

            Thank you,

            --
            Tom.
            -----------
            Thomas Boyda
            thomas.boyda@...
          Your message has been successfully submitted and would be delivered to recipients shortly.