SOAP::Lite weirdness

SOAP::Lite weirdness

am 06.04.2006 14:07:36 von gabkin

I am writing a SOAP client, and I've been having difficulties using
SOAP::Lite to work properly with the supplied service. I have a sample
SOAP request, which was created using PHP, and I know that it works, so
I simply need to 'copy' it with perl, in order to get it working,
right?

Anyway, this is what the successful PHP-composed SOAP envelope looks
like:

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="http://www.freshdigital.co.uk/mediastore">


$SESSIONID


ARTISTID
2047
true


OR
0
50




(the $SESSIONID bit should actually contain a valid sessionID, which I
removed for this public posting)
And the documentation says this about their 'search' functionality.
requires: sessionid, searchTerms (an array of search criteria),
searchtype (AND or OR), offset, and count.

anyway, this is the perl code I used to 'emulate' this SOAP call.

my @searchterms = (
SOAP::Data->name("searchTerms" =>
\SOAP::Data->value(SOAP::Data->name("item" =>
[

SOAP::Data->type('string')->name('key')->value('GENRE'),

SOAP::Data->type('string')->name('value')->value('rock'),

SOAP::Data->type('boolean')->name('like')->value('true')
]
))
)
);
my $result = $soap->search( $sessionID, @searchterms, "OR", 0, 10 );

which results in this SOAP envelope being passed on to the SOAP
service:


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/enco ding/">

xmlns:namesp2="http://www.freshdigital.co.uk/mediastore">
$SESSIONID

SOAP-ENC:arrayType="xsd:anyType[3]">
GENRE
rock
true


OR
0
10




(once again, I have changed the real sessionID to $SESSIONID, for
privacy reasons).
which, while being more verbose, appears (to me) to be much the same
thing.
Unfortunately, I get this (not very useful) error message from the
service, after submitting the above search request:

soapenv:Server.userException
java.lang.ArrayStoreException:
[Ljava.lang.Object;


xmlns:ns1="http://xml.apache.org/axis/">bridgaa2


So it looks like some kind of problem with the array, but other than
that, I have no idea what I am doing wrong. Perhaps someone more
experienced with SOAP can point out my obvious mistake, or what the
problem may be.

My apologies if this post has been a bit verbose with the XML, but I
felt it was necessary in order to figure out the problem.

Re: SOAP::Lite weirdness

am 06.04.2006 16:16:13 von gabkin

well, I officially feel like a dolt now.
The 'problem' was that I was using two arrays, and I should have been
using one.
This is what my code should have looked like:

my $searchterms = SOAP::Data->name(searchTerms =>
\SOAP::Data->name(item =>
\SOAP::Data->value(
SOAP::Data->name(key => 'ARTISTID'),
SOAP::Data->name(value => '2047')->type('string'),
SOAP::Data->name(like => 'true')->type('boolean'),
)
)
);
my $result = $soap->search( $sessionID, $searchterms, "OR", 0, 10 );


Sorted. Thanks anyway, to all who may have taken the time to read my
post, its appreciated all the same.