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
Somnath Paul 3Somnath Paul 3 

Apex Continutaion call back response does not captured in visualforce page

Hi, 
The following apex visualforce page and the controller retrieves the response which is getting captured in the debug log but does not get displayed on the vf page.

Apex Controller
============
public class BankDetailsController {
    
    public Id accId {get;set;}
    public Account acc {get;set;}
    public String accname {get; set;}
    public String Response {get; set;}
    public AsyncSoapSforceComSchemasClassGetbankdet.getBankDetailsResponse_elementFuture resp;
    public Object startAsyncCall() 
    {
         Account acc =  [select Name from Account where Id =: ApexPages.currentPage().getParameters().get('id')];
        Continuation con = new Continuation(60);
        con.ContinuationMethod = 'processResponse';
        
        //string accname = 'GoGlobalStrategies';
        partnerSoapSforceCom.Soap myPartnerSoap = new partnerSoapSforceCom.Soap(); 
        partnerSoapSforceCom.LoginResult partnerLoginResult = myPartnerSoap.login('somnath.paul4@cognizant.com', '**********');
        soapSforceComSchemasClassGetbankdet.SessionHeader_element webserviceSessionHeader=new soapSforceComSchemasClassGetbankdet.SessionHeader_element();
        webserviceSessionHeader.sessionId = partnerLoginResult.sessionId;
       // soapSforceComSchemasClassGetbankdet.GetBankDetailsofAccount getBankdet=new soapSforceComSchemasClassGetbankdet.GetBankDetailsofAccount();
        //getBankdet.SessionHeader=webserviceSessionHeader;*/
         AsyncSoapSforceComSchemasClassGetbankdet.AsyncGetBankDetailsofAccount asyngetbnkdet = new AsyncSoapSforceComSchemasClassGetbankdet.AsyncGetBankDetailsofAccount();
        
        asyngetbnkdet.SessionHeader = webserviceSessionHeader;
        system.debug('session header'+ asyngetbnkdet.SessionHeader);
        resp = asyngetbnkdet.beginGetBankDetails(con, acc.Name);
        system.debug('resp from action'+ resp);
        return con;
    }
    public Object processResponse()
    {
        Response = resp.getValue();
        system.debug('Response from get Value'+ Response);
        return null;
    }
        
}

VF Page
========
<apex:page controller="BankDetailsController">
     <apex:form >
   <apex:pageBlock >
         <apex:pageBlockSection >
               Congratulations {!$User.FirstName}
             Following are the Bank Details:
                   <apex:commandButton value="Get Bank Details" action="{!startAsyncCall}" reRender="Response"/>
       </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
    <apex:outputText value ="{!Response}"/>
</apex:page>


Can any body please reply what went wrong in the VF page. 
Best Answer chosen by Somnath Paul 3
Vishal Negandhi 16Vishal Negandhi 16
This is because you're rerendering id "Response" which isn't assigned to any component. 
Try this and it should work:

<apex:outputPanel id="{!Response}" >
<apex:outputText value ="{!Response}"/>
</apex:outputPanel>

 - So basically, you're rerendering the outputpanel with id="response" and within it, you display your error message. 

Hope this helps! :)

All Answers

Vishal Negandhi 16Vishal Negandhi 16
This is because you're rerendering id "Response" which isn't assigned to any component. 
Try this and it should work:

<apex:outputPanel id="{!Response}" >
<apex:outputText value ="{!Response}"/>
</apex:outputPanel>

 - So basically, you're rerendering the outputpanel with id="response" and within it, you display your error message. 

Hope this helps! :)
This was selected as the best answer
Somnath Paul 3Somnath Paul 3
Thanks Vishal.

Got to say that did work!!

:)