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
RYakerRYaker 

PHP: API 5. can't create a lead - INVALID_TYPE

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:enterprise.soap.sforce.com"
>
<SOAP-ENV:Header>

<ns4:SessionHeader SOAP-ENV:actor="http://schemas.xmlsoap.org/soap/actor/next" SOAP-ENV:mustUnderstand="0">
<ns4:sessionId>vnBx6uDEQnw.FPi5KwcXjh9wKr63cngqkk3sW4phR7C_Zw2uMVDxYcLaxC9.OTMZzJJr.XY7uh1aldSO_EJZ9DteaH1xyGi1</ns4:sessionId></ns4:SessionHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>

<ns4:create>
<ns4:sObjects>
<ns4:type>Lead</ns4:type>
<ns4:City>San Francisco</ns4:City>
<ns4:Company>Hotwire</ns4:Company>
<ns4:Country>USA</ns4:Country>
<ns4:Email>wally@hotwire.com</ns4:Email>
<ns4:FirstName>Wally</ns4:FirstName>
<ns4:Industry>ecommerce/travel</ns4:Industry>
<ns4:Inquiry__c>General / Pending</ns4:Inquiry__c>
<ns4:LastName>Finley</ns4:LastName>
<ns4hone>415-343-8484</ns4hone>
<ns4ostalCode>94105</ns4ostalCode>
<ns4:State>CA</ns4:State>
<ns4:Street>333 Market Street, Suite 100 </ns4:Street></ns4:sObjects></ns4:create>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SuperfellSuperfell
Your using the enterprise endpoint, the <ns4:sObjects> element needs to contain an xsi:type="ns4:Lead" attribute.

Message Edited by SimonF on 12-06-2004 08:40 AM

adamgadamg
Are you using the PHP toolkit for sforce from sourceforge?
RYakerRYaker
It seems its a PHP or soap thing.
I moved my code and the sforce classes gened from the WSDL to another server and it worked. Thanks.

Now I am trying to figure out doing a delete from PHP, do I need to have an array if IDs, or can I pass a single ID to delte.
DevAngelDevAngel

Hi RYaker,

The delete, as defined in the WSDL, requires and array of ids.  Deleting a single record is accomplished with a single element array.