Thank you for your sample salesforce wsdl sample.
Unfortunately the sample only shows how to query and delete objects, not how to create them.
I'm trying to figure out how to create an object.
Ultimately, I think the resulting XML request must contain something like:
<env:Body>
<create xmlns="urn:enterprise.soap.sforce.com"><sObject xsi:type="Account"><
name>Spaceley Sprockets</name></sObject></create>
</env:Body>
But I can't figure out any way to set the xsi:type attribute on the sObject (or SObjects).
My last attempt looked something like:
so = SObject.new("Account", nil, nil, { :name => "Spaceley Sprockets" })
params = Create.new([so])
result = binding.create(params).result
But when I run this, the wiredump looks like:
= Request
POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.4 (/92, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Mon Sep 12 22:58:03 PDT 2005
Content-Length: 899
Host: na1-api.salesforce.com
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header>
<SessionHeader env:mustUnderstand="0"
xmlns="urn:partner.soap.sforce.com">
<sessionId>0uLbGV0UZKL0L23vzH823Du9kt2hodevLF81DISnUpkDOcPws_l1Py_JRxy.SBGj_LTU568QNJVwD2reihliUxhD2wYHcrlK4SNdGN37zi4=</sessionId>
</SessionHeader>
<CallOptions env:mustUnderstand="0"
xmlns="urn:partner.soap.sforce.com">
<client>client</client>
</CallOptions>
</env:Header>
<env:Body>
<create xmlns="urn:partner.soap.sforce.com">
<sObjects>
<any>
<name>Spaceley Sprockets</name>
</any>
<type>Account</type>
</sObjects>
</create>
</env:Body>
</env:Envelope>
= Response
HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
Date: Tue, 13 Sep 2005 05:58:06 GMT
0303
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>common.exception.ApiException: Must send a concrete entity type.</faultstring>
<detail>
<sf:fault xsi:type="sf:InvalidSObjectFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com">
<sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>
<sf:exceptionMessage>Must send a concrete entity type.</sf:exceptionMessage>
<sf:row>-1</sf:row>
<sf:column>-1</sf:column>
</sf:fault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
0
I'm sure I'm calling this incorrectly, but I can't figure out what the proper syntax is to set the attributes on the sObjects.
Any help will be GREATLY appreciated.
Thanks.