You need to sign in to do that
Don't have an account?
OHT API
"Unable to find a deserializer" error when using php toolkit
Hello everyone,
Searched this topic for the better part of this day, but no solution came up.
Im encountring a strange message while trying to create a new contact.
This is a simplified case which reproduces the problem over my system.
The problem is, an exception is thrown. The last "echo" prints out
Im using SoapClient native package of PHP5.3.
If any other data needed, please ask and i'll provide ASAP.
Would appreciate any suggestion or tips on this issue.
Thank you very much in advance
Searched this topic for the better part of this day, but no solution came up.
Im encountring a strange message while trying to create a new contact.
$username = "Username"; /* edited out */ $password = "Password"; /* edited out */ $token = "token"; /* edited out */ $auth = $password . $token; $connection = new \SforceEnterpriseClient(); $connection->createConnection(Manager::WSDL); /* the location of the wsdl file is correct */ $loginResponse = $connection->login($username, $auth); /* Login is successful */Up until this point everything is going smooth. Now, Im trying to do a create contact request:
try { //Creating the Contact $contact = new \Contact(); $contact->FirstName = "First"; $contact->LastName = "Last"; $response = $connection->create(array($contact), 'Contact'); var_dump($response); } catch (Exception $e) { echo $e->getMessage(); }
This is a simplified case which reproduces the problem over my system.
The problem is, an exception is thrown. The last "echo" prints out
Unable to find a deserializer for the type common.api.soap.wsdl.QueryResult Error Id: 1664238328-34686 (2133394444)Seems like its coming from the SoapClient itself. but i might be wrong.
Im using SoapClient native package of PHP5.3.
If any other data needed, please ask and i'll provide ASAP.
Would appreciate any suggestion or tips on this issue.
Thank you very much in advance
Uncaught SoapFault exception: [soapenv:Server] Unable to find a deserializer for the type common.api.soap.wsdl.QueryResult Error Id: 1029389879-113259 (-1340098697)
My code was sending every field/property of a custom SalesForce object. Many of the values for these field/properties were empty. When I changed the code to only send field/properties with valid values the create request processed fine.
So for the example code posted at the beginning of this thread: I would pass the Conact instance as the $_fullObj parameter to this funtion, then pass the returned object to the create call.
There may be a better way to do this, possibly using the fieldsToNull special property for the 'empty' fields/porperties, but this seemed simple for my implementation.
I was getting this message when trying to update a list of Opportunity records. Turned out that this was because I was updating the same object that I got from a query, and one (or more) of the queried fields on that object were not writable. I think it was either "recordtype.name" or "amount". What I ended up doing was creating a new instance of Opportunity object for update purposes.
1) Query for the Opportunity records, including related lists, and certain non-writable fields.
2) Instead of updating the objects you get from the query in Step# 1, create a NEW List of NEW Opportunities for update purposes, and only populate the fields that you want to update.
ArrayList<Opportunity> queryOpps = apiCaller.executeQuery(queryString);
ArrayList<Opportunity> updateOpps = new ArrayList<Opportunity>();
for (Opportunity queryOpp : queryOpps) {
// some condition for update
if (queryOpp.getAmount() < queryOpp.getProjected_Revenue__c()) {
// create a new Opportunity, instead of adding the queryOpp to the update list
Opportunity updateOpp = new Opportunity();
updateOpp.setId(queryOpp.getId());
updateOpp.setStageName("Needs Review");
updateOpps.add(updateOpp);
}
}
apiCaller.update(updateOpps);