There are three separate issues here:
- Is the Enterprise WSDL the right tool to call from Apex to achieve what you want to do.
- If you did proceed with the Enterprise WSDL, how would you call it to create the report folder.
- 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:
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.