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:

  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:

  [0] => stdClass Object
      [Account__c] => 00146000003Sb9GAAS
      [Name] => 54545454545
      [Serial_ID__c] => S-2017-0000000002
      [Warranty_Expire__c] => 2017-03-09


<?xml version="1.0" encoding="UTF-8"?>
      <ns1:sessionId>...removed just because.  No problem with connectivity...</ns1:sessionId>
      <ns1:sObjects xsi:type="ns1:Serial_Number__c">


  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">
        <extension base="ens:sObject">
            <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"/>
  • Checking if you had tried upsert for standard object like mentioned here
    – Raul
    Mar 13, 2017 at 5:57
  • I just ran the mentioned test. Create works fine. Upsert fails the same way.
    – Byron
    Mar 13, 2017 at 6:17
  • org.xml.sax.SAXException: Deserializing parameter 'sObjects': could not find deserializer for type {urn:enterprise.soap.sforce.com}Contact
    – Byron
    Mar 13, 2017 at 6:28
  • Did you try using different wsdl version. Error is quite strange.
    – Raul
    Mar 13, 2017 at 6:29
  • It looks like there is something wrong in my setup. I'm not sure what. In addition, |'m wondering if the Master-Detail thing is what's failing. Am I missing something with Account__r? My gut says yes, but I can't find examples that make it clear so far.
    – Byron
    Mar 13, 2017 at 6:36

2 Answers 2


I think there is a namespace issue in the XML message.

  <ns1:sObjects xsi:type="ns1:Serial_Number__c">

Note the xsi:type="ns1:Serial_Number__c". That is saying the Serial_Number__c type is defined in the same namespace as sObjects, upsert, etc.

  • xmlns:ns1="urn:enterprise.soap.sforce.com"

That doesn't sound right. Usually the sObjects themselves are split off from the types that drive the API. You would typically see something like:

  • xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"

And then expect that namespace to be used for Serial_Number__c. E.g.

  <ns1:sObjects xsi:type="urn1:Serial_Number__c">

I've never really tried to use PHP so I'm not sure how that translates into the toolkit usage. Worst case, create an issue in the Force.com-Toolkit-for-PHP github project.


Nope. Too early morning. It works okay for update, but not for upsert.

While this is still a helpful update....it's not the solution.

I discovered this morning something I didn't know...that of course makes perfect sense.

When I read through the Custom Object documentation I either overlooked the fact (which seems really obvious in retrospect) that a custom object has it's own ID field. I thought I had to create my own ID (Serial_ID__c).

After playing around more with the Partner version of the API I observed errors that said I didn't have an ID in my objects...so this morning I did a describeSObject and discovered the ID field that I didn't realize was in there.

After adding the real ID to the object, I no longer see the error I was seeing.

There are other things I need to resolve, but this particular issue appears to be resolved.

  • As a workaround, I split up my calls to use create & update and skip upsert for now.
    – Byron
    Mar 15, 2017 at 0:48
  • I think I've messed up the external ID field. I'm betting that is why it's failing for upsert.
    – Byron
    Mar 15, 2017 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.