2

I am using WSDL classes generated from the WSDL xml, to make the webservice callouts. I was making the callout synchronously, but later I want to change it to Asynchronous callouts. As we already know that the WSDL classes generated will be having Async classes. So, I am using the Async WSDL classes in conjunction with the Continuation class. Here I am posting sample code:

public Continuation startRequest(){
       Integer TIMEOUT_INT_SECS = 120;         
       AsynWSDLClass.methodResponseFuture respFuture;
       Continuation cont = new Continuation(TIMEOUT_INT_SECS);
       cont.continuationMethod = 'processResponse';   
       AsynWSDLClass.exampleServicesPort service = new AsynWSDLClass.exampleServicesPort();
       service.endpoint_x = 'https://api.example.com/dev/exampleService';      
       service.timeout_x = 120000; 
       try{         
           respFuture = service.beginExampleServiceMethod(cont, payload);    
       }catch(Exception e){
           System.debug(e.getMessage());
           return null;
       }
       System.debug('async is called - I am assuming that webservice callout initiated'); 
       return cont;
}
public Object processResponse(){
    System.debug('hello....response received');
    //do some processing
    return null;
}

So, I have called the startRequest() method from other method. When I call this method I am getting the log statement async is called - I am assuming that webservice callout initiated. But the callback method is not called.

I know that as the callout is asynchronous it may take some time. But my query is Where Can I see the async callout status in salesforce UI in the Monitoring section. How can I know that the webservie asyncronous callout is happened actually? If happened, how can I confirm that?

Please help on this.

  • Have you checked the Apex jobs section?? there all the future and batch jobs get listed. – Mr.Frodo May 10 '16 at 11:47
  • @Mr.Frodo - I couldn't see my job in the apex job list, I have looked at all the jobs with all possible state values. I forgot to mention the same in question. But I believe the asyn callout is made, because the debug log is showing 1 out of 100 callouts. and I could see the WebServiceCallout.beginInvoke() method is also executing. – Azeez May 10 '16 at 12:11
  • 1
    @Mr.Frodo. With the continuation method, the job doesn't go into the flex queue. It simply allows additional time as opposed to a standard http callout from a visualforce page. See developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…. – crmprogdev May 10 '16 at 12:52
  • 1
    @Azeez, have you looked at your debug logs? Have you created a test class? Have you whitelisted your endpoint? Your debug logs and test class should tell you a lot about what might be going on. – crmprogdev May 10 '16 at 14:42
  • 1
    Thank you for your help. It is working if I am calling the Continuation method directly from VF page. But I was trying to do that Continuation coding in a Util calss and tried to call it from VF, So it was not working. But not sure why is it so. Thank you. – Azeez Jun 6 '16 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.