Home > Archive > PERL Miscellaneous > March 2005 > Soap::Lite Cant get array of results?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Soap::Lite Cant get array of results?
|
|
|
| [Many apologies for the duplicate post. Problem is quite urgent !]
I am using ActiveState Perl 5.8.6
I have a .NET web service that returns
<soap:Envelope ...>
<soap:Body>
<myOperationResponse xmlns="nyService">
<myOperationResult>
<Wrapper>
<Customer>customer 1 data</Customer>
<Customer>customer 2 data</Customer>
...
...
...
...
<Customer>customer 50 data</Customer>
</wrapper>
</myOperationResult>
</myOperationResponse>
</soap:Body>
</soap:Envelope>
The number of levels of 'wrapper' elements are for intergration reasons
and cannot be reasonably changed during this phase.
However when I query the first example using SOAP::Lite I can only see
the data for Customer 50 in the example above. It is like a hash was
used to hold the low level elements. It is definitely the first and NOT
the last customer element when looking at the raw data coming down the
wire.
Using paramsout() doenst help as paramsout is always undefined.
I'm sure I'm missing something as it seems such a simple problem and not
one I would expect to be a bug in SOAP::Lite. But I'm at a loss!
You will have to excuse my perl, but the function I use to display the
result is as follows:
sub showElem() {
( my $indent,my $tag,my $elem ) = @_;
if ( ref($elem) eq 'ARRAY' ) {
# This clause doesnt get invoked at all
my $i=0;
foreach my $item ( @$elem ) {
&showElem("$indent ","$tag"."[$i]",$item);
$i++;
}
} elsif ( ref($elem) eq 'HASH' ) {
print "\n$indent<$tag>\n";
foreach my $key ( keys %$elem ) {
my $value = $$elem{$key}; #Could something be wrong
here?
&showElem("$indent ",$key,$value);
}
print "$indent</$tag>\n";
} else {
print "$indent<$tag>$elem</$tag>\n";
}
}
Any ideas why only my last customer element is being shown?
--
Lordy
| |
| Gabriel Reid 2005-03-30, 3:57 pm |
| Lordy wrote:
>
> I have a .NET web service that returns
>
>
> <soap:Envelope ...>
> <soap:Body>
> <myOperationResponse xmlns="nyService">
> ...
> </soap:Body>
> </soap:Envelope>
>
>
> The number of levels of 'wrapper' elements are for intergration reasons
> and cannot be reasonably changed during this phase.
>
> However when I query the first example using SOAP::Lite I can only see
> the data for Customer 50 in the example above. It is like a hash was
> used to hold the low level elements. It is definitely the first and NOT
> the last customer element when looking at the raw data coming down the
> wire.
>
> ...
> the function I use to display the
> result is as follows:
>
> sub showElem() {
> .....
>
> }
>
> Any ideas why only my last customer element is being shown?
>
First of all, no, I don't know why you're only seeing the last customer
record. However, all that I've seen is the SOAP envelope as tranferred
on the wire (I assume), and your method of displaying the values. There
are a number of places things could be going wrong here, but I don't
think you've provided enough information to see them.
What I would do first is use the Data::Dumper module to output the
value(s) you're getting back from SOAP::Lite (instead of your own output
function, which may just be hiding the problem).
Gabriel
|
|
|
|
|