Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. public with sharing class CallUpdatePersonAttributes_pt {
  2.  
  3.  
  4. @future (callout=true)
  5. public static void updateCDBPerson(){
  6. HttpRequest req = new HttpRequest();
  7. req.setEndpoint('http://192.168.25.175:8011/PersonDS/ProxyService/PersonDS');
  8. req.setMethod('POST');
  9. req.setHeader('Content-Type', 'text/xml; charset=utf-8');
  10. req.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
  11. //req.setHeader('SOAPAction', 'https://api.authorize.net/soap/v1/CreateCustomerProfile');//
  12.  
  13. //send the request
  14. Http http = new Http();
  15. HttpResponse res = http.send(req);
  16. string b = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'+
  17. '<soap:Body>'+
  18. '<ns1:UpdatePersonAttributesRequest xmlns:ns1="urn:engineersaustralia:cdm:generic:common:service:v1">'+
  19. '<ns1:PersonID>2713020</ns1:PersonID>'+
  20. '<ns1:Sex>M</ns1:Sex>'+
  21. '<ns1:UpdatedBy>1111</ns1:UpdatedBy>'+
  22. '</ns1:UpdatePersonAttributesRequest>'+
  23. '</soap:Body></soap:Envelope>';
  24. req.setBody(b);
  25. try{
  26. res = http.send(req);
  27. System.debug(res.toString());
  28. System.debug('STATUS:'+res.getStatus());
  29. System.debug('STATUS_CODE:'+res.getStatusCode());
  30. }
  31. catch(System.CalloutException e){}
  32.  
  33. }
  34.  
  35. }
  36.  
  37. trigger TestDBAdapTrigger on Contact (after update) {
  38.  
  39. for(Contact ct:Trigger.new){
  40. CallUpdatePersonAttributes_pt.updateCDBPerson();
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement