I created the APEX class from the WSDL of an ASP.NET asmx service, this now gives me access to the types and methods provided by my service.

One of the methods takes in a List of objects described by the method: (ex: ASP.NET method)

[WebMethod(Description = "Consumes a list of changes from Salesforce.")]
        public void NotifyChanges(List<SalesforceChangeType> changes)
            foreach (var changeType in changes)
                log.Info(string.Format("Type:{0}, Id:{1}", changeType.ChangeType, changeType.EntityId));

I am trying to call this web service but when the APEX class was generated it created a type of ArrayOfSalesforceChangeType which is also the argument for the method.

TriggerService.SalesforceChangeType change = new TriggerService.SalesforceChangeType();

TriggerService.ArrayOfSalesforceChangeType changes = new TriggerService.ArrayOfSalesforceChangeType();

TriggerService.TriggerServiceSoap svc = new TriggerService.TriggerServiceSoap();

changes.add(change) <-- doesn't work, reports "Method doesn't exist or incorrect signature" 

// changes[0] = change; <-- doesn't work either "Expression must be a list type: Service.ArrayofSalesforceChangeType"


So my question is how do I add items to a custom List that was generated from the APEX generated WSDL..

Hope this makes sense to someone..


  • Can you post a link to a Gist of the WSDL and the generate Apex class please? Apr 24, 2013 at 0:04

1 Answer 1


The apex class for ArrayOfSalesforceChangeType will appear something like:

public class ArrayOfSalesforceChangeType {
    public ApexClassForWSDL.SalesforceChangeType[] SalesforceChangeType;
    private String[] SalesforceChangeType_type_info = new String[]{'SalesforceChangeType','http://webservice/api','SalesforceChangeType','0','-1','true'};
    private String[] apex_schema_type_info = new String[]{'http://webservice/api','true','false'};
    private String[] field_order_type_info = new String[]{'SalesforceChangeType'};

You will need to add the records to the SalesforceChangeType member.


TriggerService.ArrayOfSalesforceChangeType changes = new TriggerService.ArrayOfSalesforceChangeType();
TriggerService.SalesforceChangeType change = new TriggerService.SalesforceChangeType();
changes.SalesforceChangeType = new List<SalesforceChangeType>();
  • Thanks... exactly what I was looking for, got caught up with the naming convention ArrayOf and stopped there.
    – Rick
    Apr 24, 2013 at 15:28
  • @FishOfPrey I have been facing the same issue, Thanks for the solution. But for the line, changes.SalesforceChangeType.add(change); I am getting an exception, 'Attempt to de-reference a null object'. I am unable to add the change in SalesforceChangeType.
    – logan
    Jan 5, 2018 at 8:21
  • @logan the internal list/array needs to be initialized before adding the new change instance. Jan 7, 2018 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .