Subject: | Explicit types bypass SOAP::Lite handling, including string encoding |
WWW::Salesforce::Constants sets explicit types for known fields. Known
string fields are given the type 'xsd:string'. This bypasses
SOAP::Lite's as_string() method, which would have called
SOAP::Utils::encode_data() to encode < and &.
This results in the following problematic behavior:
$sforce->create(type => 'lead', Email => 'foo@example.com', Company =>
'Foo & Bar', Custom__c => 'Bar & Foo');
...
<sObjects xsi:type="sfons:lead">
<sfons:Email xsi:type="xsd:string">foo@example.com</sfons:Email>
<sfons:Company xsi:type="xsd:string">Foo & Bar</sfons:Company>
<sfons:Custom__c xsi:type="xsd:string">Bar & Foo</sfons:Industry__c>
</sObjects>
...
Observe that the value for Company was not encoded, but the value for
Custom__c was.
I believe the appropriate fix is to update WWW::Salesforce::Constants to
remove the 'xsd:' from all the type names. If the type is 'string'
instead of 'xsd:string', then SOAP::Lite will call as_string(), and the
value will be encoded.
Of course, this is not a backwards compatible change...
WWW::Salesforce 0.14
SOAP::Lite 0.710.10
perl 5.10.1