0

I am trying to generate the apex class from wsdl file.

While trying to create a class I am getting the following 2 error.

"Error: enterpriseSoapSforceCom

Error: Invalid type: sobjectEnterpriseSoapSforceCom.sObject_x at 43:16"

"Error: sobjectEnterpriseSoapSforceCom

Error: Script too large: //Generated by wsdl2apex public class sobjectEnterpriseSoapSforceCom { public class User_x { ... at -1:-1"

  • why do you want to generate apex class using enterprise wsdl? it meant to use for the integration on the external interfaces – Bforce Apr 22 '14 at 14:53
  • I want to create a report folder via apex, for that purpose I am retrieving the apex class from wsdl – Mangoski Apr 22 '14 at 14:56
1

There are three separate issues here:

  1. Is the Enterprise WSDL the right tool to call from Apex to achieve what you want to do.
  2. If you did proceed with the Enterprise WSDL, how would you call it to create the report folder.
  3. How can you generate Apex classes to call the Enterprise WSDL without getting the "Script too large" error message from wsdl2apex.

I'm going to largely skip over 1 and 2 for now other than saying that the Enterprise WSDL isn't really intended for consumption within Salesforce. This would be better addressed in the question Can we create report folders through Apex.

3. Generating minimal Apex for the Enterprise WSDL

I've been working with an intern on a tool that will generate Apex for calling a WSDL. Part of this process is giving you control over which methods from the web service ultimately get generated in Apex.

With the Enterprise WSDL, you may only want to generate several of the 45 available methods.

Reducing the number of methods reduces the size of the generated apex class and reduces the number of methods you need to have covered by test cases.

If you are keen to try it, download the latest version of the FuseIT SFDC Explorer. There is a tab along the top called WSDL2Apex that will start the process off.

After defining the Apex class names for each namespace in the WSDL, you can pick and choose which methods will be generated in Apex:

Choosing WSDL methods to generate in Apex

One other benefit here is that you can generate basic tests and mock classes to give you coverage for the generated code.

Note that you many still need to remove some of the generated inner classes that aren't required.

  • Yes your 3rd point is valid I am getting script too large error when I tried to apex class from Enterprise WSDL. The information you shared was useful – Mangoski May 9 '14 at 14:24

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.