Guest User

Untitled

a guest
Feb 8th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. public PageReference doDirectPayment()
  2. {
  3.  
  4. HttpRequest httpRequest = new HttpRequest();
  5. httpRequest.setEndpoint('https:/VinProviderxxxx.php');
  6. String body = 'id=01123999999198&key=xxxxxxx&vin=1GNSKHE34BRxxxxxxx&mode=test&user=vxxxxxx&pass=slll4250&format=xml';
  7. httpRequest.setBody(body);
  8. httpRequest.setMethod('GET');
  9. Http htt = new hTTP();
  10. HttpResponse httpRe = htt.send(httpRequest);
  11. system.debug(httpRe.geTbody());
  12. String re = httpRe.geTbody();
  13.  
  14. Dom.Document doc = httpRe.getBodyDocument();
  15. Dom.XMLNode address = doc.getRootElement();
  16.  
  17. String clean= address.getChildElement('clean', null).getText();
  18. String vinDate= address.getChildElement('date', null).getText();
  19.  
  20. String state = address.getChildElement('specs', null).getText();
  21. // print out specific elements
  22.  
  23. System.debug('address: ' + address);
  24. System.debug('state: ' + state);
  25.  
  26.  
  27.  
  28. system.debug('result'+re);
  29.  
  30.  
  31. for(Dom.XMLNode child : address.getChildElements()) {
  32. if(child.getName() == 'specs'){
  33. System.debug('******'+child.getText());
  34. }
  35. }
  36.  
  37.  
  38. Vehicle__c ve =[select Name,Id,Vin_Audit_Response__c,Year__c from Vehicle__c where id =: vehicleId];
  39. ve.Vin_Audit_Response__c=re;
  40. // ve.Year__c =sYear;
  41.  
  42. }
Add Comment
Please, Sign In to add comment