You need to sign in to do that
Don't have an account?
Somnath 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.
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.
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
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! :)
Got to say that did work!!
:)