function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DbjensenDbjensen 

Why is a class WSDL file so large when passing in a list?

Hello - I have a very simple web service class that receives a Contact list. When I generate a WSDL file, it's too large to upload. 

Is there a way to create a smaller WSDL file for a list? 
webservice static string createContactRecord(List<Contact> contactArray){
        
        List<Contact> insertContactList = new List<Contact>();
        for(Contact ct : contactArray){
            insertContactList.add(ct);
        }
        insert insertContactList;
        
        return 'Success';
    }

However, if I pass in strings, the WSDL it's not large. 
Webservice static string createContactRecord (String FirstName, String LastName, String Company){

        Contact ct = new Contact();
        ct.FirstName = FirstName;
        ct.LastName = LastName;
        ct.Company = Company;
        insert ct;
        
        return 'Success';

    }



 
Best Answer chosen by Dbjensen
AbhishekAbhishek (Salesforce Developers) 
In short, your answers are "No tool, but you can DIY".

I wish there are simple tools can do it because my WSDL contains too many unused functions and schema of data structure.

If I can automate it, WSDL -> trimmed WSDL -> generate client stubs classes. Nothing unused will be generated, no misuse, no maintenances required, we will not touch on the generated code, and I can really focus on the code which in use. Smaller JAR, shorter XML parse time. If the WSDL gets updated, I will have only to rebuild client stubs classes and run the unit test.

I tried to keep off from human invoked. It takes time, easy to get mistake, and have to redo every time every little change on the original WSDL.

It might answer your query.

All Answers

AbhishekAbhishek (Salesforce Developers) 
In short, your answers are "No tool, but you can DIY".

I wish there are simple tools can do it because my WSDL contains too many unused functions and schema of data structure.

If I can automate it, WSDL -> trimmed WSDL -> generate client stubs classes. Nothing unused will be generated, no misuse, no maintenances required, we will not touch on the generated code, and I can really focus on the code which in use. Smaller JAR, shorter XML parse time. If the WSDL gets updated, I will have only to rebuild client stubs classes and run the unit test.

I tried to keep off from human invoked. It takes time, easy to get mistake, and have to redo every time every little change on the original WSDL.

It might answer your query.
This was selected as the best answer
DbjensenDbjensen
Thanks for the help, Abhishek. Trimming seems like such a pain.