+ Start a Discussion
Eamon WongEamon Wong 

Web Service: Method does not exist or incorrect signature

Hello All!
I am hoping you can assist me with an error I am receiving:
"Save error: Method does not exist or incorrect signature: vcport2(List<RPSWS.WebSearch_element>)    RPSWS2.cls"

//---------- BEGIN RPSWS2.cls
public class RPSWS2 {
     public static Boolean AsyncWebSearchFlag = false;
    
    @Future(callout=true) 
    public static void RPSWS(Set<ID> ids) {
        try {
            // Build list of addresses to validate
            Map<ID, Supplier__c> mapCands = findCandidates(ids);
            List<RPSWS.WebSearch_element> vclistAddress = new List<RPSWS.WebSearch_element>();

            for (Supplier__c scand : mapCands.values()) {
                RPSWS.WebSearch_element address = new RPSWS.WebSearch_element();
                
                address.sSecno = 'XYZ';
                address.sPassword = '123Pass';
                address.sOptionalID = scand.ID;
                address.sName = scand.Legal_Name__c;
                address.sAddress = '$' + scand.Legal_City__c + '$' + '{'+ scand.Legal_State__c + '}';
                address.sCountry = 'USA';
                vclistAddress.add(address);
            }
                        
            // Make callout
            RPSWS.RPSServiceSoap vcport2 = new RPSWS.RPSServiceSoap();
            List<RPSWS.WebSearchResponse_element> vclistResult = vcport2.WebSearch_element(vclistAddress); //THIS IS WHERE THE ERROR IS


            // Verify results
            for (RPSWS.WebSearchResponse_element vcresult : vclistResult) {
                Supplier__c scand = mapCands.get(vcresult.WebSearchResult);
                if (vcresult.WebSearchResult.contains('GREEN FLAG')) {
                    scand.Visual_Compliance_Approval__c = true;
                    scand.Visual_Compliance_Reason_Code__c = 'AUTO: ' + datetime.now();
                } else {
                    scand.Visual_Compliance_Approval__c = false;
                    scand.Visual_Compliance_Reason_Code__c = 'Invalid Address';                 
                }
            }
            
            // Update Candidate
            AsyncWebSearchFlag = true;
            update mapCands.values();
        } catch (Exception ex) {
            // Handle Exception
            System.debug('ERROR: '+ ex);
            Error_Log__c log = new Error_Log__c();
            log.trace__c = ex.getCause() + '\n' + ex.getMessage();
            insert log;        
        }
    }

    private static Map<ID, Supplier__c> findCandidates(Set<ID> ids) {
        Map<ID, Supplier__c> output;
        output = new Map<ID, Supplier__c>([SELECT ID, Legal_Name__c, Legal_City__c,
                                                Legal_State__c, Legal_Postal_Code__c
                                            FROM Supplier__c
                                            WHERE ID in :ids]);
        return output;
    }                   
}

//---------- BEGIN RPSWS.cls
public class RPSWS {
    public class WebSearchResponse_element {
        public String WebSearchResult;
        private String[] WebSearchResult_type_info = new String[]{'WebSearchResult','http://tempuri.org/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{'WebSearchResult'};
    }
    public class WebSearch_element {
        public String sSecno;
        public String sPassword;
        public String sOptionalID;
        public String sName;
        public String sCompany;
        public String sAddress;
        public String sCountry;
        public String sModes;
        public String sRPSGroupBypass;
        private String[] sSecno_type_info = new String[]{'sSecno','http://tempuri.org/',null,'0','1','false'};
        private String[] sPassword_type_info = new String[]{'sPassword','http://tempuri.org/',null,'0','1','false'};
        private String[] sOptionalID_type_info = new String[]{'sOptionalID','http://tempuri.org/',null,'0','1','false'};
        private String[] sName_type_info = new String[]{'sName','http://tempuri.org/',null,'0','1','false'};
        private String[] sCompany_type_info = new String[]{'sCompany','http://tempuri.org/',null,'0','1','false'};
        private String[] sAddress_type_info = new String[]{'sAddress','http://tempuri.org/',null,'0','1','false'};
        private String[] sCountry_type_info = new String[]{'sCountry','http://tempuri.org/',null,'0','1','false'};
        private String[] sModes_type_info = new String[]{'sModes','http://tempuri.org/',null,'0','1','false'};
        private String[] sRPSGroupBypass_type_info = new String[]{'sRPSGroupBypass','http://tempuri.org/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{'sSecno','sPassword','sOptionalID','sName','sCompany','sAddress','sCountry','sModes','sRPSGroupBypass'};
    }
    public class RPSServiceSoap {
        public String endpoint_x = 'vendor webservice here';
        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://tempuri.org/', 'RPSWS'};
        public String WebSearch(String sSecno,String sPassword,String sOptionalID,String sName,String sCompany,String sAddress,String sCountry,String sModes,String sRPSGroupBypass) {
            RPSWS.WebSearch_element request_x = new RPSWS.WebSearch_element();
            request_x.sSecno = sSecno;
            request_x.sPassword = sPassword;
            request_x.sOptionalID = sOptionalID;
            request_x.sName = sName;
            request_x.sCompany = sCompany;
            request_x.sAddress = sAddress;
            request_x.sCountry = sCountry;
            request_x.sModes = sModes;
            request_x.sRPSGroupBypass = sRPSGroupBypass;
            RPSWS.WebSearchResponse_element response_x;
            Map<String, RPSWS.WebSearchResponse_element> response_map_x = new Map<String, RPSWS.WebSearchResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/WebSearch',
              'http://tempuri.org/',
              'WebSearch',
              'http://tempuri.org/',
              'WebSearchResponse',
              'RPSWS.WebSearchResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.WebSearchResult;
        }
    }
}
Best Answer chosen by Eamon Wong
kaustav goswamikaustav goswami
The method you are calling is wrong. For the callout to happen you need to call the following method


public String WebSearch(String sSecno,String sPassword,String sOptionalID,String sName,String sCompany,String sAddress,String sCountry,String sModes,String sRPSGroupBypass)

So the code might look something like this
RPSWS.RPSServiceSoap vcport2 = new RPSWS.RPSServiceSoap();
String returnValue = vcport2.WebSearch(....relevant list of parameters.....);

Thanks,
Kaustav

 

All Answers

kaustav goswamikaustav goswami
The method you are calling is wrong. For the callout to happen you need to call the following method


public String WebSearch(String sSecno,String sPassword,String sOptionalID,String sName,String sCompany,String sAddress,String sCountry,String sModes,String sRPSGroupBypass)

So the code might look something like this
RPSWS.RPSServiceSoap vcport2 = new RPSWS.RPSServiceSoap();
String returnValue = vcport2.WebSearch(....relevant list of parameters.....);

Thanks,
Kaustav

 
This was selected as the best answer
Eamon WongEamon Wong
Thanks for your help, Kaustav!  

I went back into my code and removed all list references and modified them to Strings.

Your help is much appreciated.