CPAN::Forum
SOAP-Lite - Unable to get SOAP::Lite 0.0710.05 to serialize my 1-D array of strings
| Posted on Thu May 22 08:45:06 2008 by timwood |
| Unable to get SOAP::Lite 0.0710.05 to serialize my 1-D array of strings |
|
This should be basic, but here I am. I am unable to get this SOAP::Lite version to serialize my 1-D array of strings. V 0.60 was doing it, but I was having namespace problems against my Java WS on the Sun App. Server. The server wants the parameter name with no namespace tag and its type tagged with the service's URI namespace. In 0.60, I could only cause both name & type to be tagged or both not. So I upgraded to the subject version. Now I can't get it to serialize the array at all. My code in brief looks like:
my ($proto, %ctorArgs) = @_; # Object reference & ctor args
...
my $proxy = SOAP::Lite->service($ctorArgs{'serviceURL'})->xmlschema(2001)->uri($ctorArgs{'facetURI'
+});
...
# Call remote myMethod1 with plain string arg1 and SOAP::Data-wrapped array.
my $soapedArg2Array = soapifyArg([ SOAP::Data->new()->value(9), SOAP::Data->new()->value(1) ]);
# SOAP::Data doc implies using a 2nd wrapper for the array
$soapedArg2Array = soapifyArg($soapedArg2Array);
# ??? Why does SOAP::Lite not let you pass a SOAP::Data holder containing the string? 0.60 did.
# It returns "String value expected instead of SOAP::Data reference".
my $result = $proxy->myMethod1($arg1, $soapedArg2Array);
...
sub soapifyArg {
my $self = shift;
my $plainArg = shift;
return SOAP::Data->new()->value(( ref($plainArg) =~ /ARRAY/ ? @$plainArg : ($plainArg) ));
}
The XML generated for the call goes like this (my comment and folding added):
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:tns="urn:Foo1" xmlns:ns2="http://java.sun.com/jax-rpc-ri/internal"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body><tns:myMethod1>
<String_1 xsi:type="xsd:string">+22522522552</String_1>
<!-- ALWAYS A NIL ARRAY --><arrayOfString_2 xsi:nil="true" xsi:type="tns:ArrayOfstring" />
</tns:myMethod1></soap:Body>
</soap:Envelope>
The server side accepts this call and returns a correct result given the data, and the client side continues. So the old 0.60 problem with ns tags is fixed. But now I am unable to get the client to supply the array data in 0.710.05.
Line 1535 of Lite.pm reads:
# This is breaking a unit test right now...
# proposed resolution for [ 1700326 ] encode_data called incorrectly in envelope
# $body->set_value(SOAP::Utils::encode_data($parameters ? \$parameters : ()))
# if $body;
# must call encode_data on nothing to enforce xsi:nil="true" to be set.
This suggests the code thinks the supplied SOAP::Data value for the array holds a nil (undef) but I've established that's not the case.
Any help is appreciated.
Thanks,
Tim
|
| Write a response |
(9)
]