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
MilanMilan 

Partner API : INVALID_TYPE: Must send a concrete entity type

Hello Friends,
 
I tried seeing many posts on INVALID_TYPE: Must send a concrete entity type but I am still confused and still havent been able to rectify my code. So I am posting my issue here.
 
I am trying to CREATE a Lead using PARTNER API. The steps followed are as follows:
  1. Login and retrieve the Server URL and Session ID. (This works)
  2. Set the new Session ID and use the retrieveed Server URL from step 1 above to make subsequent call for getUserInfo( ) . (This one works too, which means I am pointing to the right URL and have the session ID set correctly in the header)
  3. Try to create a Lead with the code snippet as follows:

Code:

              SObject[] sObject = new SObject[1];
  MessageElement[] lead = new MessageElement[5];
  lead[0] = new MessageElement(new QName("FirstName"),"Joe");
  lead[1] = new MessageElement(new QName("LastName"),"Doe");
  lead[2] = new MessageElement(new QName("Company"),"John Doe Inc");
  lead[3] = new MessageElement(new QName("Email"),"johndoe@jdoe.com");
  lead[4] = new MessageElement(new QName("Phone"),"4156832669");
  sObject[0] = new SObject();
  sObject[0].setType("Lead");
  sObject[0].set_any(lead);
         SaveResult[] sr = null;
         try {
            sr = stub.create(sObject);
         } catch (Exception ex) {
            System.out.println("An unexpected error has occurred." + ex.getMessage());
           return;
         }


 
I get the following error :

An unexpected error has occurred.INVALID_TYPE: Must send a concrete entity type.

I am using PARTNER API. Any clue what should I do ?Thanks for any insight.

Regards,

Milan

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
You're sending it to the wrong endpoint, your request is going to .../c/ which the enterprise API, it should be ../u/ see the endpoint URL in the partner WSDL.

All Answers

MilanMilan
I also tried for Contach based on the sameple code given in the API and I get the same error.
 
Code:
                  SObject[] cons = new SObject[1];
    MessageElement[] contact = new MessageElement[5];
    contact[0] = new MessageElement(new QName("FirstName"),"Joe");
    contact[1] = new MessageElement(new QName("LastName"),"Blow");
    contact[2] = new MessageElement(new QName("Salutation"),"Mr.");
    contact[3] = new MessageElement(new QName("Phone"),"999.999.9999");
    contact[4] = new MessageElement(new QName("Title"),"Purchasing Director");
    cons[0] = new SObject();
    cons[0].setType("Contact");
    cons[0].set_any(contact);
    SaveResult[] sr = null;
    try {
      sr = stub.create(cons);
    } catch (Exception ex) {
      System.out.println("An unexpected error has occurred." + ex.getMessage());
      return;
    }
    for (int j = 0; j < sr.length; j++) {
      if (sr[j].isSuccess()) {
        System.out.println("A contact was created with an id of: "
            + sr[j].getId());
      }
      else {
        // there were errors during the create call, go through the errors
        // array and write them to the screen
        for (int i = 0; i < sr[j].getErrors().length; i++) {
          // get the next error
          com.sforce.soap.partner.Error err = sr[j].getErrors()[i];
          System.out.println("Errors were found on item " +
              new Integer(j).toString());
          System.out.println("Error code: " + err.getStatusCode().toString());
          System.out.println("Error message: " + err.getMessage());
        }
      }
    }

 
The request / Response :
Code:
==============
Listen Port: 7002
Target Host: na4-api.salesforce.com
Target Port: 80
==== Request ====
POST /services/Soap/c/9.0 HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.3
Host: na4-api.salesforce.com:7002
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 941

<—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:Header>
         <ns1:SessionHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="urn:partner.soap.sforce.com">
            <ns1:sessionId>.WPO3N5AiwVIQQX4CUSRyfPJMmvCSgGVweA7pH6X95x1he6WjfkzH_tk5Grew6O7GmS81MTWl2ildySK5oGaOs_VjPG3v6wZ66PAvMDceaSej7G2AJI=</ns1:sessionId>
         </ns1:SessionHeader>
      </soapenv:Header>
      <soapenv:Body>
         <create xmlns="urn:partner.soap.sforce.com">
            <sObjects>
               <ns2:type xmlns:ns2="urn:sobject.partner.soap.sforce.com">Contact</ns2:type>
               <FirstName xmlns="">Joe</FirstName>
               <LastName xmlns="">Blow</LastName>
               <Salutation xmlns="">Mr.</Salutation>
               <Phone xmlns="">999.999.9999</Phone>
               <Title xmlns="">Purchasing Director</Title>
            </sObjects>
         </create>
      </soapenv:Body>
   </soapenv:Envelope>
   
   
==== Response ====
HTTP/1.0 500 Internal Server Error
Server: 
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 648
Date: Wed, 02 May 2007 22:06:48 GMT

<˜xml version="1.0" encoding="UTF-8"™>
   <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:fault 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:fault>
            </detail>
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>
==============

 
Any clues ?
 
Thanks,
Milan
SuperfellSuperfell
You're sending it to the wrong endpoint, your request is going to .../c/ which the enterprise API, it should be ../u/ see the endpoint URL in the partner WSDL.
This was selected as the best answer
MilanMilan

Thanks Simon! That was it. I started wiuth the wrong URL and it returned a wrong one and so on...But on pointing to the appropriate partner wsdl URL, it worked!

Thanks,

Milan

MilanMilan
I , now want to insert leads using the Enterprise API, but I get this error :
 
 <sf:fault 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:fault>
 
Now, what do I do to overcome this issue ? 
 
Just fyi : I am also researching which API to use when, but for the moment this is my understanding: We have few custom mandatory fields to be populated during isert of a new lead. I udnerstand that if I use enterprise API, it will allow me to create a lead even if the custom mandatory fields are not populated... not sure, want to try that out. But first, I need to get going by overcoming the above error.
 
Thanks,
Milan
SuperfellSuperfell
The rule apply regardless of API type used. Can you post a capture of your request?
MilanMilan

Thanks for the quick response, as awlays :).

Here is the request :

Code:

POST /services/Soap/c/9.0 HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: na4-api.salesforce.com:7002
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 36841

<—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:Header>
         <ns1:SessionHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="urn:partner.soap.sforce.com">
            <ns1:sessionId>gymhG5iC5f9AiOCQZ10JeN6Ri0VsvGdAFNgmpASjUI7YLUXrJHYGJbWhPHjxRqnb7RcjFRGqjkUB68ibQOSKtxpyrfTiCkAhI3.GME4S31RM5QthAJI=</ns1:sessionId>
         </ns1:SessionHeader>
      </soapenv:Header>
      <soapenv:Body>
         <create xmlns="urn:partner.soap.sforce.com">
            <sObjects>
               <ns2:type xmlns:ns2="urn:sobject.partner.soap.sforce.com">Lead</ns2:type>
               <FirstName xmlns=""/>
               <LastName xmlns="">Mclean</LastName>
               <Company xmlns="">Acosta  Inc</Company>
               <Email xmlns="">smclean@acosta.com</Email>
               <Phone xmlns="">4154154150</Phone>
               <Title xmlns=""/>
               <City xmlns="">city</City>
               <State xmlns="">CA</State>
               <Website xmlns="">http://www.thewebsite.com</Website>
               <Demandbase_SubIndustry__c xmlns="">SubIndustry</Demandbase_SubIndustry__c>
               <Country xmlns="">USA</Country>
               <PostalCode xmlns="">322</PostalCode>
               <Street xmlns="">The Adress Street</Street>
               <Score__c xmlns="">87</Score__c>
               <Lead_Id__c xmlns="">JUNIT_TEST</Lead_Id__c>
               <Demandbase_Industry__c xmlns="">Industry</Demandbase_Industry__c>
            </sObjects>
 <sObjects>
               <ns51:type xmlns:ns51="urn:sobject.partner.soap.sforce.com">Lead</ns51:type>
               <FirstName xmlns=""/>
               <LastName xmlns="">Hunt</LastName>
               <Company xmlns="">Acosta Sales &amp; Marketing Group</Company>
               <Email xmlns=""></Email>
               <Phone xmlns="">4154154150</Phone>
               <Title xmlns=""/>
               <City xmlns="">city</City>
               <State xmlns="">CA</State>
               <Website xmlns="">http://www.thewebsite.com</Website>
               <Demandbase_SubIndustry__c xmlns="">SubIndustry</Demandbase_SubIndustry__c>
               <Country xmlns="">USA</Country>
               <PostalCode xmlns="">917</PostalCode>
               <Street xmlns="">The Adress Street</Street>
               <Score__c xmlns="">87</Score__c>
               <Lead_Id__c xmlns="">JUNIT_TEST</Lead_Id__c>
               <Demandbase_Industry__c xmlns="">Industry</Demandbase_Industry__c>
            </sObjects>
        </create>
      </soapenv:Body>
   </soapenv:Envelope>


 Here is the response :

 

Code:

HTTP/1.0 500 Internal Server Error
Server: 
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 648
Date: Tue, 17 Jul 2007 18:58:28 GMT

<—xml version="1.0" encoding="UTF-8"–>
   <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:fault 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:fault>
            </detail>
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>


 
Kindly advice.

Thanks,

Milan

SuperfellSuperfell
You can't send a partner formatted request to the enterprise endpointURL.
MilanMilan
Ohhh...
 
Can you kindly elaborate ? You mean my request structure is incorrect or the endpoints are incorrect or that the session id is not matching etc ?
 
Thanks ,
Milan
SuperfellSuperfell
Your request structure (the XML) is for a partner API/WSDL request. But the URL you sent this message to is for the Enterprise API/WSDL.
JagJag
Hi
i 'm trying to invoke ""create"" method of salesforce from BPEL , but getting an error as "must send a concrete entity type" "invalid _type"

Here are the copy operations performed in BPEL code:

<assign name="Settings">
            <copy>
                <from variable="LoginResponse" part="parameters"
                      query="/ns1:loginResponse/ns1:result/ns1:sessionId"/>
                <to variable="Header" part="SessionHeader"
                    query="/ns1:SessionHeader/ns1:sessionId"/>
            </copy>
            <copy>
                <from>
                    <EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing">
                        <Address/>
                    </EndpointReference>
                </from>
                <to variable="partnerRef"/>
            </copy>
            <copy>
                <from expression="string(bpws:getVariableData('LoginResponse','parameters','/ns1:loginResponse/ns1:result/ns1:serverUrl'))"/>
                <to variable="partnerRef"
                    query="/ns2:EndpointReference/ns2:Address"/>
            </copy>
            <copy>
                <from variable="partnerRef"/>
                <to partnerLink="SalesForceServ"/>
            </copy>
            <copy>
                <from expression='"JS"'/>
                <to variable="AccountVar" query="/ns3:Account/ns3:Name"/>
            </copy>
            <copy>
                <from expression='"Jagjit Singh, 5/18/2008 10:40 PM"'/>
                <to variable="AccountVar" query="/ns3:Account/ns3:CreatedBy"/>
            </copy>
            <copy>
                <from expression='"Jagjit Singh"'/>
                <to variable="AccountVar" query="/ns3:Account/ns3:OwnerId"/>
            </copy>
            <copy>
                <from expression='"jagjit Singh"'/>
                <to variable="AccountVar" query="/ns3:Account/ns3:Owner"/>
            </copy>
            <copy>
                <from expression='"23344"'/>
                <to variable="AccountVar"
                    query="/ns3:Account/ns3:AccountNumber"/>
            </copy>
            <copy>
                <from variable="AccountVar"/>
                <to variable="sObject"/>
            </copy>
            <copy>
                <from expression='"D24"'/>
                <to variable="sObject" query="/ns3:sObject/ns3:Id"/>
            </copy>
            <copy>
                <from expression='"DDDD"'/>
                <to variable="sObject" query="/ns3:sObject/ns3:fieldsToNull"/>
            </copy>
            <copy>
                <from variable="sObject"/>
                <to variable="CreateRequest" part="parameters"
                    query="/ns1:create/ns1:sObjects"/>
            </copy>
        </assign>


and error in BPEL Console is:

<messages><input><CreateRequest><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="parameters"><create xmlns="urn:enterprise.soap.sforce.com">
   <ns0:sObjects xmlns="urn:sobject.enterprise.soap.sforce.com" xmlns:ns0="urn:enterprise.soap.sforce.com">
      <fieldsToNull>DDDD</fieldsToNull>
      <Id>D24</Id>
      <AccountContactRoles/>
      <AccountNumber>23344</AccountNumber>
      <AccountPartnersFrom/>
      <AccountPartnersTo/>
      <Active__c/>
      <ActivityHistories/>
      <AnnualRevenue/>
      <Assets/>
      <Attachments/>
      <BillingCity/>
      <BillingCountry/>
      <BillingPostalCode/>
      <BillingState/>
      <BillingStreet/>
      <Cases/>
      <Contacts/>
      <Contracts/>
      <CreatedBy>Jagjit Singh, 5/18/2008 10:40 PM</CreatedBy>
      <CreatedById/>
      <CreatedDate/>
      <CustomerPriority__c/>
      <Description/>
      <Events/>
      <Fax/>
      <Histories/>
      <Industry/>
      <IsDeleted/>
      <LastActivityDate/>
      <LastModifiedBy/>
      <LastModifiedById/>
      <LastModifiedDate/>
      <MasterRecord/>
      <MasterRecordId/>
      <Name>JS</Name>
      <Notes/>
      <NotesAndAttachments/>
      <NumberOfEmployees/>
      <NumberofLocations__c/>
      <OpenActivities/>
      <Opportunities/>
      <OpportunityPartnersTo/>
      <Owner>jagjit Singh</Owner>
      <OwnerId>Jagjit Singh</OwnerId>
      <Ownership/>
      <Parent/>
      <ParentId/>
      <PartnersFrom/>
      <PartnersTo/>
      <Phone/>
      <ProcessInstances/>
      <ProcessSteps/>
      <Rating/>
      <SLAExpirationDate__c/>
      <SLASerialNumber__c/>
      <SLA__c/>
      <Shares/>
      <ShippingCity/>
      <ShippingCountry/>
      <ShippingPostalCode/>
      <ShippingState/>
      <ShippingStreet/>
      <Sic/>
      <Site/>
      <SystemModstamp/>
      <Tasks/>
      <TickerSymbol/>
      <Type/>
      <UpsellOpportunity__c/>
      <Website/>
   </ns0:sObjects>
</create>
</part></CreateRequest></input><fault><InvalidSObjectFault xmlns="urn:enterprise.soap.sforce.com"><part name="fault"><sf:InvalidSObjectFault xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sf:InvalidSObjectFault">
   <sf:exceptionCode 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">INVALID_TYPE</sf:exceptionCode>
   <sf:exceptionMessage 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">Must send a concrete entity type.</sf:exceptionMessage>
   <sf:row 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">-1</sf:row>
   <sf:column 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">-1</sf:column>
</sf:InvalidSObjectFault>
</part></InvalidSObjectFault></fault></messages>


Please help me ......

Thx and regards
Jag
SuperfellSuperfell
Your first problem is that as the error states, you're not sending a type, the wsdl defines sObject to be a base type, you need to indicate (with an xsi:type attribute) the concrete type of sObject you're trying to create, e.g.

<ns0:sObjects xsi:type='ns0:Account' xmlns:ns0="urn:enterprise.soap.sforce.com">

You also have other problems, including a missing name element, and the fact that you're populating heiractical data elements with character data (e.g. createdBy & owner).

I suggest you walk through the quickstart in the docs and get some basic java or .NET samples working before jumping in with something more complex.
JagJag
Hi Simon
Thx for your quick reply...

I have already done some work in webservices in JAVA, but in BPEL it is for the first time..... So please let me know the certain steps to call the salesforce "create" method to create an account.....

I have successfully used , getuserinfo methos and query method of salesforce.....

I know sObject is an array object where i can put the account object(s) and send it to create as a parameter......

Please let me know how to do it in BPEL

Thanks...
JagJag
Hi Simon....

thx a lot for ur help...... I analysed the code closely as you said and

set " <ns0:sObjects xsi:type='ns0:Account' xmlns:ns0="urn:enterprise.soap.sforce.com">" in my sourcecode

now i m able to run "create" and "update" methods exposed by salesforce...
Problem resolved finally...

Regards
Jag

SDGSDG

Hi,

 

I am having similar issues while trying to create Accounts using BPEL. I am able to successfully login to SalesForce but not able to create. I tried to follow most of the instructions, but might have missed something.

 

Can you please tell where you updated

"<ns0:sObjects xsi:type='ns0:Account' xmlns:ns0="urn:enterprise.soap.sforce.com">". 

 

Also I am not clear as how to set "fieldsToNull". Do you happen to have the BPEL code?

 

Your response will be greatly appreciated.

 

FYI: 

I tried to update enterprise wsdl with concrete  Account element as follows below complex type Account.  

<element name="Account" type="ens:Account"/>. I am using this object to set Account values. Finally I set this account to CreateRequest/sObjects.

 

Thanks

 

Somesh