1

I am trying to understand tooling API - SOAP and was trying to create a simple Java class which uses tooling wsdl file to create Apex class. I borrowed the snippet from https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_soap_overview.htm

but I am unable to figure out which object needs to be invoked to utilize create method to create new classes: // call create() to add the class SaveResult[] saveResults = sforce.create(classes);

I tried creating SforceService sforce; but it seems to be not available. I have included wsc-22.jar and created enterprise.jar from enterprise wsdl, toolingApi.jar from tooling wsdl.

1

If you are using Tooling API via SOAP then public SaveResult[] create(SObject[] sObjects) method lives in com.sforce.soap.tooling.ToolingConnection class.

If you do not see it then this may relate to the ancient version of wsc (v22) you used or old version of Tooling WSDL.

NOTE: not sure if it has been fixed in the current Tooling API (v34), but in the past in order to use com.sforce.soap.tooling.ToolingConnection you had to establish Enterprise (or Partner) SOAP connection first and then use returned session Id and endpoint (adjusted for tooling API) to call Tooling API via ToolingConnection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.