+ Start a Discussion
SoCal AdminSoCal Admin 

Upsert to Custom Object using Partner wsdl

 


Anyone know what this error means?  I really need one working example of an upsert to a custom object using the Partner wsdl - but I can't find one.  I see all kinds of examples of inserts to Standard Objects - but not custom objects.


The login is fine, but the upsert fails.

        $sObject = new stdclass();
        $sObject->CustomerName__c = $Cust;
        $sObject->Title__c = $title;
        $sObject->Info__c = $data;
        $sObject->Type = 'mycustomobject__c';  // Is this correct?

        $result = $conn->upsert($Logid,array($sObject),'Mycustomobject__c');
        print("<HR>");
        print_r($result);
        print "<hr>";
    } catch (exception $e) {
        print "<hr>ERROR:";
        print_r($e);
        print "<hr>";
    }

 

ERROR:SoapFault Object ( [message:protected] => SOAP-ERROR: Encoding: object has no 'type' property [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\soapclient\SforceBaseClient.php [line:protected] => 514 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\soapclient\SforceBaseClient.php [line] => 514 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => upsert [1] => Array ( [0] => stdClass Object ( [externalIDFieldName] => SoapVar Object ( [enc_type] => 101 [enc_value] => a1BE0000002WlLnMAK [enc_stype] => string [enc_ns] => http://www.w3.org/2001/XMLSchema ) [sObjects] => Array ( [0] => stdClass Object ( [ID] => a1BE0000002WlLnMAK [Project__c] => a1DE0000000yrqwMNA [Subject__c] => Casting Corner  [Detail__c] => Q2222 3/12/2013 Boom Box Corporation 1.000000 DOOR (Boom) 2471.630000 16'2" x 14'1" [Type] => mycustomobject__c ) ) ) ) ) ) [1] => Array ( [file] => C:\wamp\www\soapclient\SforceBaseClient.php [line] => 514 [function] => upsert [class] => SforceSoapClient [type] => -> [args] => Array ( [0] => stdClass Object ( [externalIDFieldName] => SoapVar Object ( [enc_type] => 101 [enc_value] => a1BE0000002WlLnMAK [enc_stype] => string [enc_ns] => http://www.w3.org/2001/XMLSchema ) [sObjects] => Array ( [0] => stdClass Object ( [ID] => a1BE0000002WlLnMAK [Project__c] => a1DE0000000yrqwMNA [Subject__c] => Casting Corner  [Detail__c] => Q2222 3/12/2013 Boom Box Corporation 1.000000 DOOR (Boom) 2471.630000 16'2" x 14'1" [Type] => mycustomobject__c ) ) ) ) ) [2] => Array ( [file] => C:\wamp\www\soapclient\SforcePartnerClient.php [line] => 194 [function] => _upsert [class] => SforceBaseClient [type] => -> [args] => Array ( [0] => stdClass Object ( [externalIDFieldName] => SoapVar Object ( [enc_type] => 101 [enc_value] => a1BE0000002WlLnMAK [enc_stype] => string [enc_ns] => http://www.w3.org/2001/XMLSchema ) [sObjects] => Array ( [0] => stdClass Object ( [ID] => a1BE0000002WlLnMAK [Project__c] => a1DE0000000yrqwMNA [Subject__c] => Casting Corner  [Detail__c] => Q2222 3/12/2013 Boom Box Corporation 1.000000 DOOR (Boom) 2471.630000 16'2" x 14'1" [Type] => mycustomobject__c ) ) ) ) ) [3] => Array ( [file] => C:\wamp\www\porog\library.inc [line] => 32 [function] => upsert [class] => SforcePartnerClient [type] => -> [args] => Array ( [0] => a1BE0000002WlLnMAK [1] => Array ( [0] => stdClass Object ( [ID] => a1BE0000002WlLnMAK [Project__c] => a1DE0000000yrqwMNA [Subject__c] => Casting Corner  [Detail__c] => Q2222 3/12/2013 Boom Box Corporation 1.000000 DOOR (Boom) 2471.630000 16'2" x 14'1" [Type] => mycustomobject__c ) ) [2] => mycustomobject__c ) ) [4] => Array ( [file] => C:\wamp\www\porog\testfile.php [line] => 203 [function] => UpsertLog [args] => Array ( [0] => SforcePartnerClient Object ( [sforce:protected] => SforceSoapClient Object ( [trace] => 1 [compression] => 32 [_encoding] => utf-8 [_features] => 1 [_user_agent] => salesforce-toolkit-php/20.0 [_soap_version] => 1 [sdl] => Resource id #11 [__last_request_headers] => POST /services/Soap/u/27.0/00DE0000000KMbe HTTP/1.1 Host: na9-api.salesforce.com Connection: Keep-Alive User-Agent: salesforce-toolkit-php/20.0 Accept-Encoding: gzip, deflate Content-Type: text/xml; charset=utf-8 SOAPAction: "" Content-Length: 612 [__last_response_headers] => HTTP/1.1 200 OK Date: Wed, 20 Mar 2013 00:21:35 GMT Content-Type: text/xml;charset=UTF-8 Content-Encoding: gzip Content-Length: 370 [location] => https://na9-api.salesforce.com/services/Soap/u/27.0/00DE0000000KMbe [httpsocket] => Resource id #16 [_use_proxy] => 0 [httpurl] => Resource id #19 [__default_headers] => Array ( [0] => SoapHeader Object ( [namespace] => urn:partner.soap.sforce.com [name] => SessionHeader [data] => Array ( [sessionId] => 00DE0000000KMbe!AR8AQCyz2KQ5ZArk9BpZcwSSxH55VH_r8Qh5w3HKS6swXluzsxSSniRr0_lunxMOEsIOslVw8oBM5GmhqcrzhZpy97ln1QIR ) [mustUnderstand] => ) ) [__soap_fault] => SoapFault Object *RECURSION* ) [sessionId:protected] => 00DE0000000KMbe!AR8AQCyz2KQ5ZArk9BpZcwSSxH55VH_r8Qh5w3HKS6swXluzsxSSniRr0_lunxMOEsIOslVw8oBM5GmhqcrzhZpy97ln1QIR [location:protected] => https://na9-api.salesforce.com/services/Soap/u/27.0/00DE0000000KMbe [version:protected] => 20.0 [namespace:protected] => urn:partner.soap.sforce.com [callOptions:protected] => [assignmentRuleHeader:protected] => [emailHeader:protected] => [loginScopeHeader:protected] => [mruHeader:protected] => [queryHeader:protected] => [userTerritoryDeleteHeader:protected] => [sessionHeader:protected] => SoapHeader Object ( [namespace] => urn:partner.soap.sforce.com [name] => SessionHeader [data] => Array ( [sessionId] => 00DE0000000KMbe!AR8AQCyz2KQ5ZArk9BpZcwSSxH55VH_r8Qh5w3HKS6swXluzsxSSniRr0_lunxMOEsIOslVw8oBM5GmhqcrzhZpy97ln1QIR ) [mustUnderstand] => ) [allowFieldTruncationHeader:protected] => [localeOptions:protected] => [packageVersionHeader:protected] => [client_id:protected] => ) [1] => a1BE0000002WlLnMAK [2] => a1DE0000000yrqwMNA [3] => Casting Corner  [4] => Q2222 3/12/2013 Boom Box Corporation 1.000000 DOOR (Boom) 2471.630000 16'2" x 14'1" ) ) ) [previous:Exception:private] => [faultstring] => SOAP-ERROR: Encoding: object has no 'type' property [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: SOAP-ERROR: Encoding: object has no 'type' property in C:\wamp\www\soapclient\SforceBaseClient.php on line 514 Call Stack #TimeMemoryFunctionLocation 10.0016169000{main}( )..\testfile.php:0 20.8622836952UpsertLog( )..\testfile.php:203 30.8622838104SforcePartnerClient->upsert( )..\library.inc:32 40.8622838968SforceBaseClient->_upsert( )..\SforcePartnerClient.php:194 50.8623839104SforceSoapClient->upsert( )..\SforceBaseClient.php:514 )