You need to sign in to do that
Don't have an account?
Dan Cobb 9
Continuation Issues
Hello,
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?
Page:
<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"/> </apex:form> </apex:page>
Controller:
public with sharing class ContinuationController { private String returnedContinuationId; private String baseSericeURL = '<Im not telling you my url!>'; public ContinuationController() {} public void testSyncCallout() { HttpResponse testResponse = new HttpResponse(); HttpRequest testRequest = new HttpRequest(); HTTP HTTPService = new HTTP(); testRequest.setMethod('GET'); testRequest.setEndpoint(baseSericeURL); testRequest.setTimeout(60000); 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 con.continuationMethod='testContinuationCallback'; //Create callout request HttpRequest req = new HttpRequest(); req.setMethod('GET'); req.setEndpoint(baseSericeURL); 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 Message:
1. I have ensured both my page and controller are on API version 33, which is documented as supporting Continuation.
2. 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.
3. I have tried setting my controller as global, as the error made me think that the callback somehow can't see the class containing the actual callback method.
I had same issue :). Debug log was showing successful completion without any error but yet I was getting that error. But after that I debugged in developer console at finest level then I got something was breaking like- "ERR_NAME_NOT_RESOLVED Failed to load resource:" in some other application embedded in sidebar.
Please try to debug in developer console. If you are still getting any error then please contact with Salesforce Support.
Thanks,
A2
Hey Ayub,
Thanks for your response. I checked and unfortunately my log levels were already set to finest. There is no error logged.
Dan
I faced the same issue please contact salesforce its a bug.Its because of this tag <apex:pageMessages id="frmMsgs"/>.
If you place this tag in the page even you dont re-rendered the tag you will face the same issue.
Work Around
Replace <apex:pageMessages id="frmMsgs"/> with <apex:outputText value="{!response}" id="con"></apex:outputText> for time being.
Gokul