I'm using PHP Toolkit 20.0 (Enterprise) and the latest WSDL. Partner also fails for me.
I can successfully create (using PHP Toolkit create) objects of this type. All my attempts to Update or Upsert these fields are failing.
I'm a reasonably experienced developer....but a reasonably inexperienced SOAP/SFDC developer.
My current failure:
org.xml.sax.SAXException:
Deserializing parameter 'sObjects':
could not find deserializer for type {urn:enterprise.soap.sforce.com}Serial_Number__c
I'm baffled. Any help on what I'm missing is very welcomed. Thanks!
Here's the tl;dr version:
I created a custom object called 'Serial_Number__c' that contains custom fields:
Name /* a serial number text string */
Account__c /* a Master-Detail AccountId
to associate the serial number
with a standard Account */
Serial_ID__c /* the ID for serial number record.
Format: S-{YYYY}-{0000000000} auto increment */
Warranty_Expire__c /* a Date (apparently in text string format)
Default empty */
Warranty_Extended__c /* a Checkbox (apparently boolean one or zero)
Default Unchecked */
Here is the code (tl;dr version):
$sObject = new stdClass();
$sObject->Account__c = '00146000003Sb9GAAS'; // Account__c is a SFDC Account.Id
$sObject->Name = '54545454545';
$sObject->Serial_ID__c = 'S-2017-0000000002';
$sObject->Warranty_Expire__c = '2017-03-09';
$upsertResponse = $soap_client->upsert('Serial_ID__c', array($sObject), 'Serial_Number__c');
array sent to upsert:
Array
(
[0] => stdClass Object
(
[Account__c] => 00146000003Sb9GAAS
[Name] => 54545454545
[Serial_ID__c] => S-2017-0000000002
[Warranty_Expire__c] => 2017-03-09
)
)
SOAP REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:enterprise.soap.sforce.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
<ns1:SessionHeader>
<ns1:sessionId>...removed just because. No problem with connectivity...</ns1:sessionId>
</ns1:SessionHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:upsert>
<ns1:externalIDFieldName>Serial_ID__c</ns1:externalIDFieldName>
<ns1:sObjects xsi:type="ns1:Serial_Number__c">
<Account__c>00146000003Sb9GAAS</Account__c>
<Name>54545454545</Name>
<Serial_ID__c>S-2017-0000000002</Serial_ID__c>
<Warranty_Expire__c>2017-03-09</Warranty_Expire__c></ns1:sObjects>
</ns1:upsert>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
RESPONSE:
org.xml.sax.SAXException:
Deserializing parameter 'sObjects':
could not find deserializer for type {urn:enterprise.soap.sforce.com}Serial_Number__c
Added information:
I don't understand SOAP Namespaces very well.
Here is the section of XML that describes my custom object:
<complexType name="Serial_Number__c">
<complexContent>
<extension base="ens:sObject">
<sequence>
<element name="Account__c" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="Account__r" nillable="true" minOccurs="0" type="ens:Account"/>
<element name="ActivityHistories" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="AttachedContentDocuments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Attachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="CombinedAttachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="ContentDocumentLinks" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="CreatedBy" nillable="true" minOccurs="0" type="ens:User"/>
<element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="DuplicateRecordItems" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Emails" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Events" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="FeedSubscriptionsForEntity" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Feeds" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Histories" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean"/>
<element name="LastActivityDate" nillable="true" minOccurs="0" type="xsd:date"/>
<element name="LastModifiedBy" nillable="true" minOccurs="0" type="ens:User"/>
<element name="LastModifiedById" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="LastModifiedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="LastReferencedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="LastViewedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="LookedUpFromActivities" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Name" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="Notes" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="NotesAndAttachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="OpenActivities" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="ProcessInstances" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="ProcessSteps" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="RecordAssociatedGroups" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Serial_ID__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="SystemModstamp" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="Tasks" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="TopicAssignments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="UserRecordAccess" nillable="true" minOccurs="0" type="ens:UserRecordAccess"/>
<element name="Warranty_Expire__c" nillable="true" minOccurs="0" type="xsd:date"/>
<element name="Warranty_Extended__c" nillable="true" minOccurs="0" type="xsd:boolean"/>
</sequence>
</extension>
</complexContent>
</complexType>