CC: | peter.sandin [...] ziprecruiter.com |
Subject: | base64Binary content becomes undef if it contains wide characters |
I'm calling the service at https://webservices.netsuite.com/wsdl/v2015_1_0/netsuite.wsdl with XML::Compile::WSDL11.
When attempting to send string content in a base64Binary element, I get errors like the following when the string contains wide characters:
error: illegal value `undef' for type {http://www.w3.org/2001/XMLSchema}base64Binary at platformMsgs:upsert/record/mediaItemList/mediaItem/content
Normally the MIME::Base64 encode_base64 function used by XML::Compile::Schema::BuiltInTypes's base64Binary support would croak on receiving wide characters on content without an encoding. However the calls to encode_base64 and decode_base64 in XML::Compile::Schema::BuiltInTypes (starting in line 306 in v1.50) are wrapped in eval calls, so the croak is neutered and the passed string becomes undef.
The croaked error should instead be caught and passed as the correct error string, rather than the confusing message above. This would hint to the developer that they need to make sure their string has been encoded so that MIME::Base64 can correctly encode it to base64.