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
JDegnerJDegner 

Help with WSDL, Custom Type Array, Web Service Callout, and DataTable

I'm new to Salesforce development, so please forgive my ignorance.

 

What I'm trying to do: Receive data from my web service and format it into a data table

 

When I test my web service in the browser, it returns the data I need:

 

<?xml version="1.0" encoding="UTF-8"?>

<ArrayOfLFIDoc xmlns="http://webservices.cpgnet.com/LFIWebService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<LFIDoc>

<lfdocid>19</lfdocid>

<lfdocname>CD451796 - Edge Communications - Account</lfdocname>

<lfdocpages>1</lfdocpages>

<lfdoctemplate>Account</lfdoctemplate>   

<lfdocpath>\Accounts</lfdocpath>

</LFIDoc>

<LFIDoc>

<lfdocid>21</lfdocid>

<lfdocname>CD451796 - Edge Communications - Contact</lfdocname>

<lfdocpages>1</lfdocpages>

<lfdoctemplate>Account</lfdoctemplate>

<lfdocpath>\Accounts</lfdocpath>

</LFIDoc>

<LFIDoc>

<lfdocid>10</lfdocid>

<lfdocname>CD451796 - Edge Communications - History</lfdocname>

<lfdocpages>1</lfdocpages>

<lfdoctemplate>Account</lfdoctemplate>

<lfdocpath>\Accounts</lfdocpath>

</LFIDoc>

<LFIDoc>

<lfdocid>23</lfdocid>

<lfdocname>CD451796 - Edge Communications - Location</lfdocname>

<lfdocpages>1</lfdocpages>

<lfdoctemplate>Account</lfdoctemplate>

<lfdocpath>\Accounts</lfdocpath>

</LFIDoc>

<LFIDocxsi:nil="true"/>

</ArrayOfLFIDoc>

 

I created the class by using the WSDL:

//Generated by wsdl2apex

public class LFIWebService {
    public class LFSearch_element {
        public String LFServer;
        public String LFRepo;
        public String LFUser;
        public String LFPassword;
        public String strID;
        public String strName;
        private String[] LFServer_type_info = new String[]{'LFServer','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] LFRepo_type_info = new String[]{'LFRepo','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] LFUser_type_info = new String[]{'LFUser','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] LFPassword_type_info = new String[]{'LFPassword','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] strID_type_info = new String[]{'strID','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] strName_type_info = new String[]{'strName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webservices.cpgnet.com/LFIWebService/','true','false'};
        private String[] field_order_type_info = new String[]{'LFServer','LFRepo','LFUser','LFPassword','strID','strName'};
    }
    public class LFIWebServiceSoap {
        public String endpoint_x = 'http://webservices.cpgnet.com/LFIWebService/LFIWebService.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://webservices.cpgnet.com/LFIWebService/', 'LFIWebService'};
        public LFIWebService.ArrayOfLFIDoc LFSearch(String LFServer,String LFRepo,String LFUser,String LFPassword,String strID,String strName) {
            LFIWebService.LFSearch_element request_x = new LFIWebService.LFSearch_element();
            LFIWebService.LFSearchResponse_element response_x;
            request_x.LFServer = LFServer;
            request_x.LFRepo = LFRepo;
            request_x.LFUser = LFUser;
            request_x.LFPassword = LFPassword;
            request_x.strID = strID;
            request_x.strName = strName;
            Map<String, LFIWebService.LFSearchResponse_element> response_map_x = new Map<String, LFIWebService.LFSearchResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://webservices.cpgnet.com/LFIWebService/LFSearch',
              'http://webservices.cpgnet.com/LFIWebService/',
              'LFSearch',
              'http://webservices.cpgnet.com/LFIWebService/',
              'LFSearchResponse',
              'LFIWebService.LFSearchResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.LFSearchResult;
        }
    }
    public class ArrayOfLFIDoc {
        public LFIWebService.LFIDoc[] LFIDoc;
        private String[] LFIDoc_type_info = new String[]{'LFIDoc','http://webservices.cpgnet.com/LFIWebService/','LFIDoc','0','-1','true'};
        private String[] apex_schema_type_info = new String[]{'http://webservices.cpgnet.com/LFIWebService/','true','false'};
        private String[] field_order_type_info = new String[]{'LFIDoc'};
    }
    public class LFSearchResponse_element {
        public LFIWebService.ArrayOfLFIDoc LFSearchResult;
        private String[] LFSearchResult_type_info = new String[]{'LFSearchResult','http://webservices.cpgnet.com/LFIWebService/','ArrayOfLFIDoc','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webservices.cpgnet.com/LFIWebService/','true','false'};
        private String[] field_order_type_info = new String[]{'LFSearchResult'};
    }
    public class LFIDoc {
        public String lfdocid;
        public String lfdocname;
        public String lfdocpages;
        public String lfdoctemplate;
        public String lfdocpath;
        private String[] lfdocid_type_info = new String[]{'lfdocid','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] lfdocname_type_info = new String[]{'lfdocname','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] lfdocpages_type_info = new String[]{'lfdocpages','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] lfdoctemplate_type_info = new String[]{'lfdoctemplate','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] lfdocpath_type_info = new String[]{'lfdocpath','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://webservices.cpgnet.com/LFIWebService/','true','false'};
        private String[] field_order_type_info = new String[]{'lfdocid','lfdocname','lfdocpages','lfdoctemplate','lfdocpath'};
    }
}

 

When I get the return data into Salesforce, it looks like this:

 

LFIWebService.ArrayOfLFIDoc:[LFIDoc=(LFIWebService.LFIDoc:[apex_schema_type_info=(http://webservices.cpgnet.com/LFIWebService/, true, false), field_order_type_info=(lfdocid, lfdocname, lfdocpages, lfdoctemplate, lfdocpath), lfdocid=19, lfdocid_type_info=(lfdocid, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocname=CD451796 - Edge Communications - Account, lfdocname_type_info=(lfdocname, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpages=1, lfdocpages_type_info=(lfdocpages, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpath=\Accounts, lfdocpath_type_info=(lfdocpath, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdoctemplate=Account, lfdoctemplate_type_info=(lfdoctemplate, http://www.w3.org/2001/XMLSchema, string, 0, 1, false)], LFIWebService.LFIDoc:[apex_schema_type_info=(http://webservices.cpgnet.com/LFIWebService/, true, false), field_order_type_info=(lfdocid, lfdocname, lfdocpages, lfdoctemplate, lfdocpath), lfdocid=21, lfdocid_type_info=(lfdocid, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocname=CD451796 - Edge Communications - Contact, lfdocname_type_info=(lfdocname, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpages=1, lfdocpages_type_info=(lfdocpages, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpath=\Accounts, lfdocpath_type_info=(lfdocpath, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdoctemplate=Account, lfdoctemplate_type_info=(lfdoctemplate, http://www.w3.org/2001/XMLSchema, string, 0, 1, false)], LFIWebService.LFIDoc:[apex_schema_type_info=(http://webservices.cpgnet.com/LFIWebService/, true, false), field_order_type_info=(lfdocid, lfdocname, lfdocpages, lfdoctemplate, lfdocpath), lfdocid=10, lfdocid_type_info=(lfdocid, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocname=CD451796 - Edge Communications - History, lfdocname_type_info=(lfdocname, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpages=1, lfdocpages_type_info=(lfdocpages, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpath=\Accounts, lfdocpath_type_info=(lfdocpath, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdoctemplate=Account, lfdoctemplate_type_info=(lfdoctemplate, http://www.w3.org/2001/XMLSchema, string, 0, 1, false)], LFIWebService.LFIDoc:[apex_schema_type_info=(http://webservices.cpgnet.com/LFIWebService/, true, false), field_order_type_info=(lfdocid, lfdocname, lfdocpages, lfdoctemplate, lfdocpath), lfdocid=23, lfdocid_type_info=(lfdocid, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocname=CD451796 - Edge Communications - Location, lfdocname_type_info=(lfdocname, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpages=1, lfdocpages_type_info=(lfdocpages, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpath=\Accounts, lfdocpath_type_info=(lfdocpath, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdoctemplate=Account, lfdoctemplate_type_info=(lfdoctemplate, http://www.w3.org/2001/XMLSchema, string, 0, 1, false)], LFIWebService.LFIDoc:[apex_schema_type_info=(http://webservices.cpgnet.com/LFIWebService/, true, false), field_order_type_info=(lfdocid, lfdocname, lfdocpages, lfdoctemplate, lfdocpath), lfdocid=null, lfdocid_type_info=(lfdocid, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocname=null, lfdocname_type_info=(lfdocname, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpages=null, lfdocpages_type_info=(lfdocpages, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdocpath=null, lfdocpath_type_info=(lfdocpath, http://www.w3.org/2001/XMLSchema, string, 0, 1, false), lfdoctemplate=null, lfdoctemplate_type_info=(lfdoctemplate, http://www.w3.org/2001/XMLSchema, string, 0, 1, false)]), LFIDoc_type_info=(LFIDoc, http://webservices.cpgnet.com/LFIWebService/, LFIDoc, 0, -1, true), apex_schema_type_info=(http://webservices.cpgnet.com/LFIWebService/, true, false), field_order_type_info=(LFIDoc)]



I've tried multiple different routines to loop through the array being returned so I can display my data, however I just can't get it! I'm lost, and can use any help!

Thanks in advance :-)

Jerri