I am trying to use Continuation for the first time and am hitting a strange error. Below is a simple page I created with both a Synchronous Callout and a Continuation Callout button. When, in my developer org, I press the "Synchronous Callout" button, I get a response as expected. When I press the "Continuation Callout" button I get an error, "Apex class 'ApexPage.ContinuationController' does not exist". Have you seen this? Do I not understand Continuation?

I have created a remote site setting for the service I am calling out to. I have ensured both my page and controller are on API version 33, which is documented as supporting Continuation. I have tried setting my controller and callback method as global, the error made me think that the callback somehow can't see the class containing the actual callback method. That had no effect.

Debug logs show successful completion and exiting of the method "testContinuationCall" The log contains no errors. There is no second log created for the callback, which I would expect.


<apex:page controller="ContinuationController" showChat="false" showHeader="false" sidebar="false" id="pg">
    <apex:pageMessages id="frmMsgs"/>   
    <apex:form id="pgFrm" >
        <apex:commandButton action="{!testSyncCallout}" value="Synchronous Callout" reRender="frmMsgs"/>
        <apex:commandButton action="{!testContinuationCall}" value="Continuation Callout" reRender="frmMsgs"/>


public with sharing class ContinuationController {

    private String returnedContinuationId;
    private String baseSericeURL = 'http://www.zillow.com/webservice/GetDeepSearchResults.htm';

    public ContinuationController() {}

    public void testSyncCallout() {
        HttpResponse testResponse = new HttpResponse();
        HttpRequest testRequest = new HttpRequest();
        HTTP HTTPService = new HTTP();
        testResponse = HTTPService.send( testRequest );
        ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.INFO,  testResponse.getStatusCode() + ': ' + testResponse.getStatus() + ' '+ testResponse.getBody()) );

    public Object testContinuationCall() {
        //Timeout in seconds, 60 is limit
        Continuation con = new Continuation(60);
        //Set callback method
        //Create callout request
        HttpRequest req = new HttpRequest();
        returnedContinuationId = con.addHttpRequest(req);
        return con;

    public Object testContinuationCallback() {
        //Get the response by using the unique label
        HttpResponse httpRes = Continuation.getResponse(returnedContinuationId);
        ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.INFO,  httpRes.getStatusCode() + ': ' + httpRes.getStatus() + ' '+ httpRes.getBody()) );
        //Return null to re-render the original Visualforce page
        return null;

Error: Continuation Error

  • Is the class added to the "Enabled Apex Class Access" list for the current profile? Jul 15 '15 at 1:50
  • Yes, the class is in the "Enabled Apex Class Access" list. Good suggestion though. I am running as System Admin, and the class has always been enabled for Sys Admin, but I enabled the class for all profiles now just for gits and shiggles. Same result.
    – Dan
    Jul 15 '15 at 2:02

I can confirm that what is causing your error is this line:

ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.INFO,  response.getStatusCode() + ': ' + response.getStatus() + ' '+ response.getBody()) );

When I set the result to an apex:outputText everything works fine.

Why that is, I don't know - I suggest you raise the issue with Salesforce Support. I think they have a bug.

  • I am now storing the response in a controller property and attempting to use an output text component to display it. I removed the line for adding an Page Message entirely. I get the exact same error when hitting the "Continuation Callout" button. You might be on to something but I don't think we've narrowed on it entirely. Can you post your code that was successful?
    – Dan
    Jul 15 '15 at 2:32
  • Playing around a little more I discovered that removing <apex:pageMessages id="frmMsgs"/> tag from the page solves the issue. Thanks for your help!
    – Dan
    Jul 15 '15 at 2:50
  • Oops sorry didn't see this until now - yeah, that's what I did to get the error to go away. Glad I could help :) Jul 15 '15 at 3:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.