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
lauraecilauraeci 

sObject type is not supported when using custom objects in the PHP Soap API

Using the PHP API code...

$theQuery = "Select s.TranscriptGrade__c, s.SystemModstamp, s.StudentID__c, 
            s.StudentCourseID__c, s.SignatureGrade__c, s.ReceiptNumber__c, s.Project_ID__c, 
            s.OwnerId, s.Name, s.Multi_Class_Project_id__c, s.LastModifiedDate, s.LastModifiedById, 
            s.IsDeleted, s.Id, s.GradeDate__c, s.EvalPosted__c, s.CreditStatus__c, s.CreatedDate, 
            s.CreatedById, s.ClientID__c From STUDENT_COURSE__c s Where s.ClientID__c='" . $theContactID . "'";
 
$result = $theSFConnection->query($theQuery); 

I am getting the error:

Unexpected exception of type [SoapFault] with message [INVALID_TYPE: 
s.CreatedById, s.ClientID__c From STUDENT_COURSE__C s Where s.ClientID__c=''
                                  ^
ERROR at Row:5:Column:47
sObject type 'STUDENT_COURSE__C' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names

Tried the same call using the Java Eclipse schema tool and the query succeeds so there seems to be an issue with the PHP API.  We are developing our application with the requirement of using PHP so we would like to figure out a work around to this issue.

Thanks,
-Laura 
Best Answer chosen by Admin (Salesforce Developers) 
Park Walker (TAGL)Park Walker (TAGL)

Just to clarify, you do need to regenerate an Enterprise WSDL when you make changes to your organization's data definitions. You do not need to regenerate a Partner WSDL.

 

The Enterprise WSDL contains definitions of all of the objects in your database and is specific to the organization that it was generated from.

 

The Partner WSDL is generic (the same for all organizations) and is only specific to the environment it was generated in - production vs. sandbox. With the Partner WSDL you can easily change where the connection makes by changing the endpoint from http://www.salesforce.com/... for production to http://test.salesforce.com/... for a sandbox. You should not try this with the Enterprise WSDL unless you know that the data structures are identical.

 

The two have different programming models so you will want to decide which is more appropriate for your use before you get started. In general, if the code you are developing is for one organization and does not need to be portable the Enterprise WSDL will be easier. If you are developing code for multiple organizations or you intend to share your code you should use the Partner WSDL.

 

Park

 

p.s. Note that the Enterprise WSDL has nothing to do with an Enterprise version of Salesforce.com. You can use either WSDL with any Salesforce.com version that supports API access.

All Answers

ptepperptepper

You might be using the wrong WSDL file. Are you using partner or enterprise?

lauraecilauraeci

Hi,

 

I am not sure which version I am using, currently I am developing with a free developer account but we have added an Enterprise account.  

 

How do I chose the correct WSDL File?  

 

Thanks for your help.

ptepperptepper

I usually use the partner WSDL, I've gotten these kinds of missing object errors when using enterprise.

 

I think the files are stored in your /includes/soapclient directory in the PHP API files.

 

You may need to generate new ones. Here's how to generate the WSDL files:

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_partner.htm

 

I think you need different ones for the sandbox vs production servers.

 

You provide the WSDL file as an argument to the createConnection function.

 

I think you might need to regenerate the WSDL if you add new objects.

 

 

Park Walker (TAGL)Park Walker (TAGL)

Just to clarify, you do need to regenerate an Enterprise WSDL when you make changes to your organization's data definitions. You do not need to regenerate a Partner WSDL.

 

The Enterprise WSDL contains definitions of all of the objects in your database and is specific to the organization that it was generated from.

 

The Partner WSDL is generic (the same for all organizations) and is only specific to the environment it was generated in - production vs. sandbox. With the Partner WSDL you can easily change where the connection makes by changing the endpoint from http://www.salesforce.com/... for production to http://test.salesforce.com/... for a sandbox. You should not try this with the Enterprise WSDL unless you know that the data structures are identical.

 

The two have different programming models so you will want to decide which is more appropriate for your use before you get started. In general, if the code you are developing is for one organization and does not need to be portable the Enterprise WSDL will be easier. If you are developing code for multiple organizations or you intend to share your code you should use the Partner WSDL.

 

Park

 

p.s. Note that the Enterprise WSDL has nothing to do with an Enterprise version of Salesforce.com. You can use either WSDL with any Salesforce.com version that supports API access.

This was selected as the best answer
lauraecilauraeci

I'm looking at the generated Enterprise WSDL and it seems like some of my custom objects are missing from this file, particularly the one I am using in the code example yet others are there.  I am not sure why some objects show up in the file.

Park Walker (TAGL)Park Walker (TAGL)

Only the custom object which were defined at the time that the WSDL was generated, and in the instance it was generated from (sandbox, production, etc) will appear on the WSDL. Try regenrtating it from the instance you are working in.

 

Park

lauraecilauraeci

Thanks for all the info everyone.  I'm up and running with the parter wsdl.