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
Sandeep Kumar GaddamSandeep Kumar Gaddam 

Problem with Callout from salesforce.

Hello All

I have used an wesdl to generate apex classe inside salesforce and when i am trying to call it from excute anonymous window in developer console i am getting an error.

here is the class generated :

//Generated by wsdl2apex

public class AsyncVerisysComBr {
    public class RegisterActivationResponse_elementFuture extends System.WebServiceCalloutFuture {
        public verisysComBr.dtoRegistro getValue() {
            verisysComBr.RegisterActivationResponse_element response = (verisysComBr.RegisterActivationResponse_element)System.WebServiceCallout.endInvoke(this);
            return response.RegisterActivationResult;
        }
    }
    public class AsyncWebService1Soap {
        public String endpoint_x = 'http://181.192.160.53/wsIntegracaoDiscador/sandeepIntegrationWS.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public String clientCertName_x;
        public Integer timeout_x;
        public verisysComBr.ValidationSoapHeader ValidationSoapHeader;
        private String ValidationSoapHeader_hns = 'ValidationSoapHeader=http://verisys.com.br/';
        private String[] ns_map_type_info = new String[]{'http://verisys.com.br/', 'verisysComBr'};
        public AsyncVerisysComBr.RegisterActivationResponse_elementFuture beginRegisterActivation(System.Continuation continuation,String ID) {
            verisysComBr.RegisterActivation_element request_x = new verisysComBr.RegisterActivation_element();
            request_x.ID = ID;
            return (AsyncVerisysComBr.RegisterActivationResponse_elementFuture) System.WebServiceCallout.beginInvoke(
              this,
              request_x,
              AsyncVerisysComBr.RegisterActivationResponse_elementFuture.class,
              continuation,
              new String[]{endpoint_x,
              'http://verisys.com.br/RegisterActivation',
              'http://verisys.com.br/',
              'RegisterActivation',
              'http://verisys.com.br/',
              'RegisterActivationResponse',
              'verisysComBr.RegisterActivationResponse_element'}
            );
        }
    }
}

i am trying to exectue using this below code 

AsyncVerisysComBr.RegisterActivationResponse_elementFuture ex1;
AsyncVerisysComBr.AsyncWebService1Soap ex2 = New AsyncVerisysComBr.AsyncWebService1Soap();
ex1 = ex2.beginRegisterActivation(60, '00vJ000000H6Nix');


Error i am getting is 

Line: 3, Column: 7
Method does not exist or incorrect signature: [AsyncVerisysComBr.AsyncWebService1Soap].beginRegisterActivation(Integer, String)

can some one help me how to call this class 

Thanks in Advance 
Best Answer chosen by Sandeep Kumar Gaddam
BDatlaBDatla
Hi Sandeep,

beginRegisterActivation method expecting System.Continuation continuation and String ID as input parameters.
Please create an instance of System.Continuation class and pass it as the first input parameter.
example :

System.Continuation continuation = new System.Continuation(60);
AsyncVerisysComBr.RegisterActivationResponse_elementFuture ex1;
AsyncVerisysComBr.AsyncWebService1Soap ex2 = New AsyncVerisysComBr.AsyncWebService1Soap();
ex1 = ex2.beginRegisterActivation(continuation, '00vJ000000H6Nix');


Let me know for any issues/clarifications.

Regards,
BDatla
 

All Answers

BDatlaBDatla
Hi Sandeep,

beginRegisterActivation method expecting System.Continuation continuation and String ID as input parameters.
Please create an instance of System.Continuation class and pass it as the first input parameter.
example :

System.Continuation continuation = new System.Continuation(60);
AsyncVerisysComBr.RegisterActivationResponse_elementFuture ex1;
AsyncVerisysComBr.AsyncWebService1Soap ex2 = New AsyncVerisysComBr.AsyncWebService1Soap();
ex1 = ex2.beginRegisterActivation(continuation, '00vJ000000H6Nix');


Let me know for any issues/clarifications.

Regards,
BDatla
 
This was selected as the best answer
Sandeep Kumar GaddamSandeep Kumar Gaddam
Thanks BDatla,

you were correct. aftert his step i try to call this class from a batchable class and run this batch apex with a scheduler. 

when i am running the scheduler i am not getting any error and getting success but the problem is the end point which i am using is intranet and it is not exposed publically so i should be getting an error saying refused or some thing like this but it is not happning so and in debug log i can see that number of callouts is 0 outoff 0 that neams a callout has not been made right ?? can you check my code if what i am doing is correct Please 

My Batch class 

global class QueryCampaignMembers implements Database.Batchable<sobject>,Database.AllowsCallouts{
string QueryString = 'SELECT Id FROM CampaignMember WHERE CV_ActiveForContact__c = TRUE AND (CV_Processado__c = FALSE OR CV_Processado__c = NULL)';    
   global QueryCampaignMembers(){       
    }
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(QueryString);
    }
    global void execute(Database.BatchableContext BC,List<sobject> members){
        try{
            system.debug('Members : ' + members);
            Set<string> myMemberIDs = new Set<string>();
            for(sobject s : members){
                s.put('CV_Processado__c',TRUE);
                myMemberIDs.add(string.valueOf(s.get('Id'))); 
            }           
            update members;
            system.debug('Campaign ID Set : ' + myMemberIDs);
            string myIds = '';
            for(string myID:myMemberIDs){
                myIds += myID + ',';
            }
            system.debug('myIds : ' + myIds);
            if(null != myIDs){
                    AsyncVerisysComBr verisys = new AsyncVerisysComBr();
                    AsyncVerisysComBr.AsyncWebService1Soap asyncWS = new AsyncVerisysComBr.AsyncWebService1Soap();
                
            }
        }
        catch(Exception ex){
            System.debug('Exception Occurred : ' + ex.getMessage() +'\n @ : '+ ex.getLineNumber());
        }
    }
     global void finish(Database.BatchableContext BC){
    }
}

Scheduler class : 

global class QueryCampaignMembers_schedule implements Schedulable {
    global void execute(SchedulableContext scMain) {
        QueryCampaignMembers clsQueryCampaignMembers = new QueryCampaignMembers();
        ID idBatch = Database.executeBatch(clsQueryCampaignMembers, 200);
    }
}

Debug log : 
Number of callouts: 0 out of 0

Please help me if i am calling it right or not