3

I am getting errors when attempting to 'Create' a custom "O2C_Alert__c" object with a SOAP request.

My request is:

<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 xmlns:urn="urn:enterprise.soap.sforce.com">
         <urn:sessionId>SESSION_ID</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:create>
         <!--Zero or more repetitions:-->
         <urn1:sObjects>
            <!--Zero or more repetitions:-->
            <urn1:type>O2C_Alert__c</urn1:type>
                <urn1:CreatedDate>20151231</urn1:CreatedDate>
                <urn1:Alert_Code__c>STD</urn1:Alert_Code__c>
                <urn1:Status__c>New</urn1:Status__c>
                <urn1:Customer_Id__C>0123456789</urn1:Customer_Id__C>
                <urn1:Name>Kroger</urn1:Name>
                <urn1:Order_Id__c>0123456789</urn1:Order_Id__c>
         </urn1:sObjects>
      </urn:create>
   </soapenv:Body>
</soapenv:Envelope>

The response I am getting back is:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:INVALID_TYPE</faultcode>
         <faultstring>INVALID_TYPE: Must send a concrete entity type.</faultstring>
         <detail>
            <sf:InvalidSObjectFault xsi:type="sf:InvalidSObjectFault">
               <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:InvalidSObjectFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Thanks for any and all help.

1 Answer 1

5

Your request is using the enterprise API, which uses XML schema's extension for managing SObject types, so instead of the <urn1:type> element, you should have <urn1:sObjects xsi:type="O2C_Alert__c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Alternatively if you want to stick with the type element approach you need to switch to the Partner API namespace & endpoint.

The docs have samples SOAP messages of both the enterprise & partner versions, or tools like SoapUI that can build messages from the WSDL are useful for validating your requests.

1
  • Excellent. That fixed it. If I could kiss you through the computer, I would. Mar 27, 2015 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .