function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David98David98 

Unable to find a de-serializer for the type { http://www.w3.org/2001/XMLSchema } anyURI

I'm just getting started with trying to use the Salesforce API, and I will admit I don't quite understand how it all fits together yet. With my first attempt at a simple script:

Code:
#!/usr/bin/perl -w
use strict;
use WWW::Salesforce::Simple;

# Authenticate with the Salesforce API based on command line parameters.
my $sforce = WWW::Salesforce::Simple->new(
        'username' => 'x',
        'password' => 'x',
);

my %lead = (
        "type"  => "Lead",
        "Email" => 'test@test.com',
        "LeadSource" => "Web Registration",
        "Company" => "Test Co",
        "Country" => "US",
        "FirstName" => "Test",
        "LastName" => "Person",
        "web_reg_dest__c" => "http://www.test.com/",
);

my $result = $sforce->create(%lead);
if ($result->result->{"success"} eq "false") {
        print $result->result->{errors}->{message} . "\n";
}

I'm receiving the error: "Unable to find a de-serializer for the type {http://www.w3.org/2001/XMLSchema}anyURI"

I have found that if I remove the "http://" from the value of web_reg_dest__c then the lead is successfully created.




Message Edited by Kingsley on 02-08-2007 04:59 PM

Ron HessRon Hess
WWW::Salesforce knows the basic types, but you need to "type cast" any new filelds that are not of type string

here is the syntax

$Salesforce::Constants::TYPES{Partner_Offering__c}->{AverageRating__c} = 'xsd:double';

you would change a few things to read:

$Salesforce::Constants::TYPES{Lead}->{web_reg_dest__c} = 'xsd:string';

put this line somewhere after the module USE statement and before the create()

basicaly if the module has to guess the type from the field contents, it uses the default gusser built into SOAP::Lite, which has some types that are not in the Salesforce WSDL

to see the types, refer to your Salesforce WSDL at:
https://na1.salesforce.com/soap/wsdl.jsp?type=*


   

EricVlachEricVlach
Warning!

The object and field names must be in lower case! Salesforce::Constants->type() includes a lc() function, but if you are setting the type this way, it must be in lowercase!

Example:
Object: X30_Day_Trial__c
Field: Postal_Code__c

$WWW::Salesforce::Constants::TYPES{x30_day_trial}->{postal_code__c} = 'xsd:string';