Guest User

Untitled

a guest
Jan 16th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. how to call rest apex class "AdobeConnectEvents from "CommandButtonParamController " class for passing the details.
  2.  
  3. <apex:page standardController="LightiningEd__Login__c"
  4. extensions="CommandButtonParamController">
  5. <apex:form >
  6. <apex:pageBlock title="Login To Adobe">
  7. <apex:pageBlockSection >
  8. <apex:inputField value="{!LightiningEd__Login__c.LightiningEd__Username__c}"/><br/>
  9. <apex:inputField value="{!LightiningEd__Login__c.LightiningEd__Password__c}"/><br/>
  10. <apex:inputField value="{!LightiningEd__Login__c.LightiningEd__URL__c}"/>
  11. </apex:pageBlockSection>
  12.  
  13. <center>
  14. <apex:commandButton id="saveBtn" value="Login" action="{!processButtonClick}" />
  15. <apex:param name="username" value="{!LightiningEd__Login__c.LightiningEd__Username__c}" assignTo="{!username}"/>
  16. <apex:param name="password" value="{!LightiningEd__Login__c.LightiningEd__Password__c}" assignTo="{!password}"/>
  17. <apex:param name = "url" value="{!LightiningEd__Login__c.LightiningEd__URL__c}" assignTo="{!url}"/>
  18. </center><br/>
  19. </apex:pageBlock>
  20. </apex:form>
  21.  
  22. private ApexPages.StandardController controller {get; set;}
  23. private LightiningEd__Login__c login {get;set;}
  24. public String username{
  25. get;
  26.  
  27. set {
  28. username= value;
  29. System.debug('value: '+value);
  30. }
  31. }
  32. public String password{
  33. get;
  34.  
  35. set {
  36. password= value;
  37. System.debug('value: '+value);
  38. }
  39. }
  40. public String url{
  41. get;
  42.  
  43. set {
  44. url= value;
  45. System.debug('value: '+value);
  46. }
  47. }
  48.  
  49. public CommandButtonParamController(ApexPages.StandardController controller) {
  50. this.controller = controller;
  51. this.login= (LightiningEd__Login__c)controller.getRecord();
  52.  
  53. }
  54.  
  55. public PageReference processButtonClick() {
  56. System.debug('username: '+username);
  57. System.debug('password: '+username);
  58. System.debug('url: '+username);
  59. PageReference pageref = new PageReference('/apex/Display_All_Webinars');
  60.  
  61. return pageref;
  62. }
  63.  
  64. @future (callout=true)
  65. global static void getParticipants(String username, String password,String url){
  66.  
  67. Http http = new Http();
  68. HttpRequest req = new HttpRequest();
  69. HttpResponse res = new HttpResponse();
  70. Blob headerValue = Blob.valueOf(username + ':' + password);
  71. String authorizationHeader = 'BASIC ' +
  72. EncodingUtil.base64Encode(headerValue);
  73. req.setHeader('Authorization', authorizationHeader);
  74. req.setEndpoint(url+'/api/xml?action=report-my-events&account-id=1309160790&&session=apac1breezdhqaxms9bksbrsmt');
  75. req.setMethod('GET');
  76. req.setHeader('Content-Type', 'application/json');
  77. req.setHeader('Accept','application/json');
  78. try {
  79. res = http.send(req);
  80. System.debug('MyResult == :'+res.getBody());
  81. XMLParserCopy s = new XMLParserCopy(res.getBody());
  82. System.debug('Response value'+s);
  83.  
  84. }catch(System.CalloutException e){
  85. System.debug('Callout error: '+ e);
  86. }//return res;
Add Comment
Please, Sign In to add comment