SOAP::Lite weirdness
am 06.04.2006 14:07:36 von gabkinI 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: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">
(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: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/">
(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:
[Ljava.lang.Object;
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.