Subject: | "Unspecified namespace for type" on value for attribute named "type" but not in XSI namespace |
Date: | Wed, 6 Dec 2017 15:00:54 +0000 |
To: | "bug-SOAP-Lite [...] rt.cpan.org" <bug-SOAP-Lite [...] rt.cpan.org> |
From: | Andy Davenport <andy [...] hmc.edu> |
Dear SOAP::Lite folk,
I am getting "Unspecified namespace for type" from "decode_object" in Lite.pm
and I think it is wrongly requiring a namespace on the value for an attribute in my SOM.
I think this is a bug at around line 2225 in "decode_object" in Lite.pm.
SOAP::Lite complains thusly when decoding the SOM returned by a successful SOAP call:
Unspecified namespace for type 'WID'
<?xml version='1.0' encoding='UTF-8'?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><wd:Change_Other_IDs_Response xmlns:wd="urn:com.workday/bsvc" wd:version="v29.1"><wd:Custom_Identifier_Event_Reference><wd:ID wd:type="WID">b1e0015e98d501192f06811d0b53cc25</wd:ID></wd:Custom_Identifier_Event_Reference></wd:Change_Other_IDs_Response></env:Body></env:Envelope> at [...]
Here is the same thing wrapped:
<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<wd:Change_Other_IDs_Response xmlns:wd="urn:com.workday/bsvc" wd:version="v29.1">
<wd:Custom_Identifier_Event_Reference>
<wd:ID wd:type="WID">b1e0015e98d501192f06811d0b53cc25</wd:ID>
</wd:Custom_Identifier_Event_Reference>
</wd:Change_Other_IDs_Response>
</env:Body>
</env:Envelope> at [...]
The culprit seems to be the un-namespace-qualified value "WID" for attribute wd:type here:
<wd:ID wd:type="WID">b1e0015e98d501192f06811d0b53cc25</wd:ID>
I believe that the code at around line 2225 in "decode_object" in Lite.pm demands a namespace
(either explicit or default) of *values* for attributes when the localpart name of the attribute
is "type" or "arrayType" *regardless* of the namespace of the name of the attribute. I don't
think it should do that.
I believe that a fix similar to this is warranted:
SOAP/Lite.pm
*** 2220,2229 ****
--- 2220,2230 ----
$1 =~ /^[xX][mM][lL]/ ||
$uris{$1} &&
do {
$attrs{SOAP::Utils::longname($uris{$1}, $2)} = do {
my $value = $attrs{$_};
+ $uris{$1} ne 'http://www.w3.org/2001/XMLSchema-instance' ||
$2 ne 'type' && $2 ne 'arrayType'
? $value
: SOAP::Utils::longname($value =~ m/^($SOAP::Constants::NSMASK?):(${SOAP::Constants::NSMASK}(?:\[[\d,]*\])*)/
? ($uris{$1} || die("Unresolved prefix '$1' for attribute value '$value'\n"), $2)
: ($uris{''} || die("Unspecified namespace for type '$value'\n"), $value)
Thank you.
Andy Davenport
Harvey Mudd College
andy@hmc.edu
--------------------------------
SOAP-Lite-1.22
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Linux xxxxxxxx.hmc.edu 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux