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
TehNrdTehNrd 

Enterprice XML Web Service request issues

Trying to mess around with the Enterprise API and I can't seem to get my XML request setup correctly.

 

Here is my XML update request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">
      <soapenv:Header>
            <urn:SessionHeader>
                  <urn:sessionId>tricks</urn:sessionId>
            </urn:SessionHeader>
      </soapenv:Header>
      <soapenv:Body>
            <urn:update>
                  <urn:sObjects xsi:type="urn1:Account">
                        <urn1:Id>0015000000Lij8E</urn1:Id>
                        <Name>test</Name>
                  </urn:sObjects>
            </urn:update>
      </soapenv:Body>
</soapenv:Envelope>

 

And here is the response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Client</faultcode>
         <faultstring>The prefix "xsi" for attribute "xsi:type" associated with an element type "urn:sObjects" is not bound.</faultstring>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

What am I messing up? I was using this as a guideline but it is very old and may be outdated: http://wiki.developerforce.com/index.php/Enterprise_Update

 

Thanks,

Jason

 

Best Answer chosen by Admin (Salesforce Developers) 
Joseph FerraroJoseph Ferraro

did you try adding:

 

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

 

to your envelope?

 

All Answers

Joseph FerraroJoseph Ferraro

did you try adding:

 

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

 

to your envelope?

 

This was selected as the best answer
DevAngelDevAngel

You are missing a namespace defintion for xsi:

 

Try this: 

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

 

TehNrdTehNrd

Thanks Joe, perfect!

stonecobra_ctostonecobra_cto

You missed defining the namespace for xsi.  You use:

 

xsi:type="urn1:Account"

 

But never said what that meant.  At the top of the request, add to the top element something like:

 

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

 

 

 This will define the namespace and allow you to continue.