+ Start a Discussion
LogmiLogmi 

INVALID_TYPE: Must send a concrete entity type

Hi - I was using the code below to create new Task records using the enterprise wsdl.  Once my code was certified, I tried to incorporate the Client ID but was told it can only be used with the partner wsdl.  I'm having problems getting my code to work with the partner wsdl with an error of "INVALID_TYPE".  Can you see what I'm doing wrong?
 
Old code using Enterprise wsdl:
Code:
            SforceService sfdc = new SforceService();
            sfdc.Url = tracking[0];
            sfdc.SessionHeaderValue = new SessionHeader();
            sfdc.SessionHeaderValue.sessionId = tracking[2];
            Integration.sforce.Task[] task = new Task[1];
            task[0] = new Integration.sforce.Task();
            task[0].WhatId = tracking[1];
            task[0].IsClosed = true;
            task[0].Subject = "Rescue Session " + SessionID;
            task[0].Description = ChatLog + "  Session Notes: " + Note;
            task[0].LastModifiedDate = DateTime.Now;
            task[0].rescue__TechID__c = TechID;
            task[0].rescue__TechName__c = TechName;
            task[0].rescue__WaitingTime__c = WaitingTime;
            task[0].rescue__PickupTime__c = PickupTime;
            task[0].rescue__ClosingTime__c = ClosingTime;
            task[0].rescue__TechDescr__c = TechDescr;
            task[0].IsClosed = true;
            task[0].Status = "Completed";
            Integration.sforce.UpsertResult ur = sfdc.upsert("Id", task)[0];


New Code that doesn't work using Partner wsdl:

Code:
            SforceService sfdc = new SforceService();
            sfdc.Url = tracking[0];
            sfdc.SessionHeaderValue = new SessionHeader();
            String clientID = "xxxxxxxxxxx";
            CallOptions co = new CallOptions();
            co.client = clientID;
            sfdc.CallOptionsValue = co;
            sfdc.SessionHeaderValue.sessionId = tracking[2];
            Integration.sforce2.sObject tk;
            sObject[] tasks = new sObject[1];
            tk = new Integration.sforce2.sObject();
            System.Xml.XmlElement[] task = new System.Xml.XmlElement[12];
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            task[0] = doc.CreateElement("IsClosed"); task[0].InnerText = "true";
            task[1] = doc.CreateElement("Subject"); task[1].InnerText = "Rescue Session " + SessionID;
            task[2] = doc.CreateElement("Description"); task[2].InnerText = ChatLog + "  Session Notes: " + Note;
            task[3] = doc.CreateElement("LastModifiedDate"); task[3].InnerText = DateTime.Now.ToString("d");
            task[4] = doc.CreateElement("TechID__c"); task[4].InnerText = TechID;
            task[5] = doc.CreateElement("TechName__c"); task[5].InnerText = TechName;
            task[6] = doc.CreateElement("WaitingTime__c"); task[6].InnerText = WaitingTime;
            task[7] = doc.CreateElement("PickupTime__c"); task[7].InnerText = PickupTime;
            task[8] = doc.CreateElement("ClosingTime__c"); task[8].InnerText = ClosingTime;
            task[9] = doc.CreateElement("TechDescr__c"); task[9].InnerText = TechDescr;
            task[10] = doc.CreateElement("IsClosed"); task[10].InnerText = "true";
            task[11] = doc.CreateElement("Status"); task[11].InnerText = "Completed";
            tk.type = "Task";
            tk.Any = task;
            tasks[0] = tk;
            SaveResult[] sr = sfdc.create(tasks);


 
 

LogmiLogmi
I found my problem.  I was still using the enterprise wsdl for my URL.