afawcett / apex-toolingapi

Apex wrapper for the Salesforce Tooling API
BSD 3-Clause "New" or "Revised" License
134 stars 98 forks source link

Create Call INVALID_TYPE: Must send a concrete entity type #37

Closed scolladon closed 8 years ago

scolladon commented 8 years ago

Hello,

I have an issue while trying to create ApexClassMember : System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: INVALID_TYPE: Must send a concrete entity type. faultcode=sf:INVALID_TYPE faultactor=

Here is the code : List<ToolingAPIWSDL.ApexClassMember> lACM = new List<ToolingAPIWSDL.ApexClassMember>(); for(ToolingAPI.ApexClass aAC : apexClasses){ // ApexClasses are previously fetched with a query call which is ok ToolingAPIWSDL.ApexClassMember aACM = new ToolingAPIWSDL.ApexClassMember(); aACM.Body = aAC.Body; aACM.ContentEntityId = aAC.Id; aACM.MetadataContainerId = aSR.id; // Come from lACM.add(aACM); } tooling.create(lACM); // This call generate the error

Is there anything wrong with the code ? How should I do ?

Regards

afawcett commented 8 years ago

Its likely because its not passing xsi:type="ApexClassMember" when the ApexClassMember is serialised to XML. The SOAP edition of this wrapper is still partly complete by the looks of it. I would recommend you take a look at the REST edition branch, https://github.com/afawcett/apex-toolingapi/tree/apex-toolingapi-rest/src/classes.

scolladon commented 8 years ago

Ok sure,

The main reason why I do not want to use the rest api for this feature is I cannot create multiple element with one callout using the rest. What changes has to be done to make it works ? I can do the development and create a pull request if you explain me

On mer. 23 mars 2016 at 14:22, Andrew Fawcett notifications@github.com wrote:

Its likely because its not passing xsi:type="ApexClassMember" when the ApexClassMember is serialised to XML. The SOAP edition of this wrapper is still partly complete by the looks of it. I would recommend you take a look at the REST edition branch, https://github.com/afawcett/apex-toolingapi/tree/apex-toolingapi-rest/src/classes.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/afawcett/apex-toolingapi/issues/37#issuecomment-200341481

afawcett commented 8 years ago

If you take a look at the types in the Apex Metadata API, MetadataService.cls you'll see a type member variable defined, also needed is type_att_info as defined here.

scolladon commented 8 years ago

Ok thanks, I will try a pull request and see with you is there are no side effects

On Fri, Mar 25, 2016 at 7:36 AM Andrew Fawcett notifications@github.com wrote:

If you take a look at the types in the Apex Metadata API, MetadataService.cls you'll see a type member variable defined https://github.com/financialforcedev/apex-mdapi/blob/master/apex-mdapi/src/classes/MetadataService.cls#L8373, also needed is _type_attinfo as defined here https://github.com/financialforcedev/apex-mdapi/blob/master/apex-mdapi/src/classes/MetadataService.cls#L8469 .

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/afawcett/apex-toolingapi/issues/37#issuecomment-201170001

scolladon commented 8 years ago

Bonjour afawcett/apex-toolingapi, Sebastien Colladon vous a laissé un message sur IQ Elite Cliquez ici a.iqelite.com/j/z8pJaH/haq/?hg=BLWDpeq7cT pour lire votre message

L'équipe d'IQ Elite


Ce message est destiné à reply@reply.github.com. Si vous ne souhaitez pas recevoir d'autres messages de la part de IQ Elite, veuillez cliquer sur ce lien : a.iqelite.com/common/unsubscribe/?code=5746a04e&email=reply@reply.github.com.&hg=BLWDpeq7cT

IQ Elite est un service de IQ Elite S.L., dont le siège se trouve à : C/ Gran De Gràcia 15, 1a 1a, 08012 Barcelone, Espagne.

scolladon commented 8 years ago

Bonjour afawcett/apex-toolingapi, Sebastien Colladon vous a laissé un message sur IQ Elite Cliquez ici a.iqelite.com/j/z8pJaH/xlt/?hg=BLWDpeq7cT pour lire votre message

L'équipe d'IQ Elite


Ce message est destiné à reply@reply.github.com. Si vous ne souhaitez pas recevoir d'autres messages de la part de IQ Elite, veuillez cliquer sur ce lien : a.iqelite.com/common/unsubscribe/?code=7e5c3aa2&email=reply@reply.github.com.&hg=BLWDpeq7cT

IQ Elite est un service de IQ Elite S.L., dont le siège se trouve à : C/ Gran De Gràcia 15, 1a 1a, 08012 Barcelone, Espagne.

scolladon commented 8 years ago

Bonjour afawcett/apex-toolingapi,

Sebastien Colladon vous a laissé un message sur IQ Elite

Cliquez ici a.iqelite.com/j/z8pJaH/xlt/?hg=4VsBvcJRlT pour lire votre message

L'équipe d'IQ Elite


Ce message est destiné à reply@reply.github.com. Si vous ne souhaitez pas recevoir d'autres messages de la part de IQ Elite, veuillez cliquer sur ce lien : a.iqelite.com/common/unsubscribe/?code=7e5c3aa2&email=reply@reply.github.com.&hg=4VsBvcJRlT

IQ Elite est un service de IQ Elite S.L., dont le siège se trouve à : C/ Gran De Gràcia 15, 1a 1a, 08012 Barcelone, Espagne.

scolladon commented 8 years ago

Bonjour afawcett/apex-toolingapi,

Sebastien Colladon vous a laissé un message sur IQ Elite

Cliquez ici a.iqelite.com/j/z8pJaH/haq/?hg=SlG7xbHLKj pour lire votre message

L'équipe d'IQ Elite


Ce message est destiné à reply@reply.github.com. Si vous ne souhaitez pas recevoir d'autres messages de la part de IQ Elite, veuillez cliquer sur ce lien : a.iqelite.com/common/unsubscribe/?code=5746a04e&email=reply@reply.github.com.&hg=SlG7xbHLKj

IQ Elite est un service de IQ Elite S.L., dont le siège se trouve à : C/ Gran De Gràcia 15, 1a 1a, 08012 Barcelone, Espagne.