SOAP::Lite weirdness

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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,

Anyway, this is what the successful PHP-composed SOAP envelope looks
<?xml version="1.0" encoding="UTF-8"?>
xmlns:SOAP-ENV=" /"
xmlns:xsd=" "
xmlns:xsi=" "
xmlns:SOAP-ENC=" /"
xmlns:ns4=" ">

(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" =>



my $result = $soap->search( $sessionID, @searchterms, "OR", 0, 10 );

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

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi=" "
xmlns:SOAP-ENC=" /"
xmlns:SOAP-ENV=" /"
xmlns:xsd=" "
SOAP-ENV:encodingStyle=" /">
xmlns:namesp2=" ">
      <session xsi:type="xsd:string">$SESSIONID</session>
        <item xsi:type="SOAP-ENC:Array"
          <key xsi:type="xsd:string">GENRE</key>
          <value xsi:type="xsd:string">rock</value>
          <like xsi:type="xsd:boolean">true</like>
      <searchType xsi:type="xsd:string">OR</searchType>
      <offset xsi:type="xsd:int">0</offset>
      <count xsi:type="xsd:int">10</count>

(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
Unfortunately, I get this (not very useful) error message from the
service, after submitting the above search request:

xmlns:ns1=" /">bridgaa2</ns1:hostname>

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

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->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.

Site Timeline