Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. System.enqueueJob(new QueueableExampleOne());
  2.  
  3. public void execute(QueueableContext context)
  4. {
  5. System.debug(System.LoggingLevel.ERROR,'From queueable example one');
  6. System.debug('This is from first queue');
  7.  
  8.  
  9. String strUsername='praveen';
  10. String strPwd='praveen';
  11. Http m_http = new Http();
  12. HttpRequest req = new HttpRequest();
  13.  
  14. String content = 'username='+EncodingUtil.urlEncode(strUsername, 'UTF-8')+'&password='+EncodingUtil.urlEncode(strPwd, 'UTF-8')+'&listname='+EncodingUtil.urlEncode('PraveenKumarG', 'UTF-8');
  15.  
  16. req.setEndpoint('http://xyz/BMEapp/API.asmx/listCreate');
  17. req.setHeader('Content-Type','application/x-www-form-urlencoded');
  18. req.setMethod('POST');
  19. req.setBody(content);
  20.  
  21. httpResponse response = m_http.send(req);
  22.  
  23. System.debug('2nd callout response=='+response.getBody());
  24.  
  25. System.enqueueJob(new QueuableExampleTwo());
  26. }
  27.  
  28. public class QueuableExampleTwo implements Queueable, Database.AllowsCallouts{
  29.  
  30. public void execute(QueueableContext ctxt){
  31. System.debug('This is from second queue');
  32.  
  33. System.debug(System.LoggingLevel.ERROR,'From QueueableContext example two');
  34.  
  35. System.enqueueJob(new QueuableExampleThree());
  36. }
  37. @future(callout =true)
  38. public static void testexecute()
  39. {
  40. String strUsername='praveen';
  41. String strPwd='praveen';
  42. Http m_http = new Http();
  43. HttpRequest req = new HttpRequest();
  44.  
  45. String content = 'username='+EncodingUtil.urlEncode(strUsername, 'UTF-8')+'&password='+EncodingUtil.urlEncode(strPwd, 'UTF-8')+'&listname='+EncodingUtil.urlEncode('PraveenKumarG', 'UTF-8');
  46.  
  47. req.setEndpoint('http://xyz/BMEapp/API.asmx/listCreate');
  48. req.setHeader('Content-Type','application/x-www-form-urlencoded');
  49. req.setMethod('POST');
  50. req.setBody(content);
  51.  
  52. httpResponse response = m_http.send(req);
  53.  
  54. System.debug(response.getBody());
  55. }}
  56.  
  57. public void execute(QueueableContext ctxt){
  58. System.debug('This is from third queue');
  59.  
  60. System.debug(System.LoggingLevel.ERROR,'From QueueableContext example two');
  61.  
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement