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
RedSquirrelRedSquirrel 

create sObject

I am trying to create a new Contact.

 

The soap error says: "The prefix "wsdl" for element "wsdl:create" is not bound."

 

 

 

s.namespaces["xmlns:urn"] = 'urn:enterprise.soap.sforce.com'

s.namespaces["xmlns:urn1"] = 'urn1:sobject.enterprise.soap.sforce.com'

s.namespaces["xmlns:xsi"] = 'http://www.w3.org/2001/XMLSchema-instance'

s.header = {'urn:SessionHeader' => {'urn:sessionId' => 'my session id'}}

s.body = {"urn:sObjects" => {"FirstName" => 'Test', "LastName" => 'Tester'}, :attributes! => {"urn:sObjects" => {"xsi:type" => 'urn1:Contact'}}}.to_soap_xml

 

The xml being sent is:

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

<env:Envelope

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:urn1="urn1:sobject.enterprise.soap.sforce.com"

xmlns:urn="urn:enterprise.soap.sforce.com"

xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

<env:Header>

<urn:SessionHeader>

<urn:sessionId>my session id</urn:sessionId>

</urn:SessionHeader>

</env:Header>

<env:Body>

<wsdl:create>

<urn:sObjects xsi:type="urn1:Contact">

<LastName>Tester</LastName>

<FirstName>Test</FirstName>

</urn:sObjects>

</wsdl:create>

</env:Body>

</env:Envelope>

 

I believe it needs to be <urn:create> not <wsdl:create> but I cannot figure out how to do that. I am using ruby and the savon libraray. Are my namespaces correct?