Continuation Error “Apex class ‘ApexPage.ContinuationController’ does not exist”

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 = '';

    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;

Continuation Error


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.

Source : Link , Question Author : Dan , Answer Author : Caspar Harmer

Leave a Comment