Hello Monks,
I know I'm kind of rehashing an
old node, but I've made some progress and would like some advice on how to proceed from here. I think the problem I've been having may be in the way SOAP::Lite serializes the array, though I may be mistaken. Here's the relevant offending code from my XRC module as it is now:
sub changePkg {
my ($username, $pkg) = @_;
my $client = connectXrc();
my $result = $client->setUserOffers(
XRC_CLIENTID,
$username,
$pkg);
}
The wsdl file defines setUserOffers like so:
<wsdl:message name="setUserOffersRequest">
<wsdl:part name="clientID" type="xs:int"/>
<wsdl:part name="username" type="xs:string"/>
<wsdl:part name="offerIDs" type="types:ArrayOfInt"/>
</wsdl:message>
And ArrayOfInt like this:
<xs:complexType name="ArrayOfInt">
<xs:annotation><![CDATA[
A SOAP encoded array of the xs:int type.
]]></xs:annotation>
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:attribute ref="soapenc:arrayType" wsdl:arrayType="xs:int[]"/
+>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
My test, which fails, is very simple. The relevant parts look like this:
my @pkg = 5544;
print "username: ";
my $username = <STDIN>;
chomp($username);
XRC::changePkg($username, @pkg);
Everything works except offerIDs (@pkg). My XML that's passed to the server defines it like this:
<offerIDs xsi:type="types:ArrayOfInt">5544</offerIDs>
However, it always fails with this fault:
<faultstring>org.xml.sax.SAXException: Found character data inside an
+array element while deserializing</faultstring>
I know I'm not actually passing a string, so I'm not really certain what's going on here. Google gave me some ideas, which I tested, but nothing ultimately came of it.
Does anyone else have a suggestion?
Thanks!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.