Advertisement
Guest User

Untitled

a guest
Apr 4th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. public static void request(String S,String cd) {
  2. string customer_code=cd;
  3. String SalesOrganization=s;
  4. String username ='****';
  5. String password ='*****';
  6. Blob headerValue = Blob.valueOf(username+':'+password);
  7. String authorizationHeader ='BASIC'+EncodingUtil.base64Encode(headerValue);
  8.  
  9. HttpRequest req = new HttpRequest();
  10. req.setEndpoint('https://da1.camso.co:50001/RESTAdapter/sold_to/batch');
  11. req.setMethod('POST');
  12. req.setHeader('Authorization', authorizationHeader);
  13. req.setBody('SalesOrganization='+EncodingUtil.urlEncode(SalesOrganization, 'UTF-8')+'&customer_code='+EncodingUtil.urlEncode(customer_code, 'UTF-8'));
  14. req.setCompressed(false); // otherwise we hit a limit of 32000
  15. try
  16. {
  17. HttpResponse res = new Http().send(req);
  18. system.debug('Response' +res.getBody());
  19. } catch(System.CalloutException e) {
  20. System.debug('Callout error: '+ e);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement