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

Array of objects

Expand Messages
  • fb_lawmaker
    hi, i ve got a little problem with an returned array of objects ... ... use Data::Dumper; use SOAP::Lite +trace = qw(debug); my $WebService =
    Message 1 of 2 , Sep 18, 2002
    • 0 Attachment
      hi,

      i've got a little problem with an returned array of objects ...

      my code:
      --------
      use Data::Dumper;
      use SOAP::Lite +trace => qw(debug);

      my $WebService = SOAP::Lite->service('file:service.wsdl');
      my @result = $WebService->HelloWorld;

      print Dumper @result;
      ---------------------

      the call of the webservice works and it gets all values (for example
      3 objects) but there is just one array/hash-element in the @result-
      variable ...
      how can i get the other ones ?

      the returned-soap-packt of the webservice:
      ------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <ArrayOfTestclass xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://tempuri.org/">
      <testclass>
      <testvar1>x0t1</testvar1>
      <testvar2>x0t2</testvar2>
      </testclass>
      <testclass>
      <testvar1>x1t1</testvar1>
      <testvar2>x1t2</testvar2>
      </testclass>
      <testclass>
      <testvar1>x2t1</testvar1>
      <testvar2>x2t2</testvar2>
      </testclass>
      </ArrayOfTestklasse>
      ------------------------------------------


      thanks
      fb
    • Eric Promislow
      Consider applying this patch. I apply it manually, as the area ... +++ Lite.pm Thu Apr 4 11:06:55 2002 @@ -1828,11 +1828,16 @@ return defined $class &&
      Message 2 of 2 , Sep 19, 2002
      • 0 Attachment
        Consider applying this patch. I apply it manually, as the area
        in question is different across versions 0.51, 0.52, and 0.55:

        --- Lite.bak.pm Thu Apr 4 11:06:32 2002
        +++ Lite.pm Thu Apr 4 11:06:55 2002
        @@ -1828,11 +1828,16 @@
        return defined $class && $class ne 'Array' ? bless($res => $class) : $res;

        } elsif ($name =~ /^\{$SOAP::Constants::NS_ENC\}Struct$/ || !$schemaclass->can($method) && (ref $children || defined $class && $value =~ /^\s*$/)) {
        - my $res = {};
        $self->hrefs->{$id} = $res if defined $id;
        - %$res = map {$self->decode_object($_)} @{$children || []};
        - return defined $class && $class ne 'SOAPStruct' ? bless($res => $class) : $res;
        -
        + if (@{$children} > 1 && $children->[0]->[0] eq $children->[1]->[0]) {
        + my $res = [];
        + @$res = map { scalar(($self->decode_object($_))[1]) }
        @{$children || []};
        + return defined $class && $class ne 'Array' ? bless($res => $class) : $res;
        + } else {
        + my $res = {};
        + %$res = map {$self->decode_object($_)} @{$children || []};
        + return defined $class && $class ne 'Struct' ? bless($res =>
        $class) : $res;

        + }
        } else {
        my $res;
        if ($schemaclass->can($method)) {

        - Eric

        > Date: Wed, 18 Sep 2002 12:28:35 -0000
        > From: "fb_lawmaker" <fb_lawmaker@...>
        > Subject: Array of objects
        >
        > hi,
        >
        > i've got a little problem with an returned array of objects ...
        >
        > my code:
        > --------
        > use Data::Dumper;
        > use SOAP::Lite +trace => qw(debug);
        >
        > my $WebService = SOAP::Lite->service('file:service.wsdl');
        > my @result = $WebService->HelloWorld;
        >
        > print Dumper @result;
        > ---------------------
        >
        > the call of the webservice works and it gets all values (for example
        > 3 objects) but there is just one array/hash-element in the @result-
        > variable ...
        > how can i get the other ones ?
        >
        > the returned-soap-packt of the webservice:
        > ------------------------------------------
        > <?xml version="1.0" encoding="utf-8"?>
        > <ArrayOfTestclass xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > xmlns="http://tempuri.org/">
        > <testclass>
        > <testvar1>x0t1</testvar1>
        > <testvar2>x0t2</testvar2>
        > </testclass>
        > <testclass>
        > <testvar1>x1t1</testvar1>
        > <testvar2>x1t2</testvar2>
        > </testclass>
        > <testclass>
        > <testvar1>x2t1</testvar1>
        > <testvar2>x2t2</testvar2>
        > </testclass>
        > </ArrayOfTestklasse>
        > ------------------------------------------
        >
        >
        > thanks
        > fb
      Your message has been successfully submitted and would be delivered to recipients shortly.