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 

xsi:type

I am trying to create a new custom object. But even before I do that I am trying to make a new Contact just to verify I know how to create something.

 

I keep getting an error about the xsi:type not being bound to a specific element. I looked in the enterprise wsdl and I believe I found what the xsi type is.

 

The definition at the top of the enterpise.wsdl looks like this:

 

<definitions targetNamespace="urn:enterprise.soap.sforce.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:enterprise.soap.sforce.com" xmlns:fns="urn:fault.enterprise.soap.sforce.com" xmlns:ens="urn:sobject.enterprise.soap.sforce.com">

 

So the type is ens?

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

Looks like your code adds in the xsi:type attribute without doing anything to add the xsi namespace declaration.

 

Yes, the xmlns:xsi=....' should be in the actual generated xml. (see the sample soap messages)

 

 

All Answers

SuperfellSuperfell

the not bound error message is an indication that you used the xsi namespace prefix in your XML request without declaring the actual namespace URI for that prefix. To use a namespace prefix, you need to delcare it, something like xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

RedSquirrelRedSquirrel

I am using Ruby Savon.

 

Here is the code I tried and changed the namespace to what you recommended. Now I get, "no operation available for request (namespace)"

 

 

client.create! do |s|
    s.header = {'wsdl:SessionHeader' => {'wsdl:sessionId' => 'session id'}}
    s.body = {"wsdl:sObjects" => {"FirstName" => 'Test', "LastName" => 'Tester'}, :attributes! => {"wsdl:sObjects" => {"xsi:type" => 'ens:Contact'}}}.to_soap_xml
  end

 

 

Do I actually want the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" inside the body?

 

SuperfellSuperfell

Looks like your code adds in the xsi:type attribute without doing anything to add the xsi namespace declaration.

 

Yes, the xmlns:xsi=....' should be in the actual generated xml. (see the sample soap messages)

 

 

This was selected as the best answer