+ Start a Discussion
s_macs_mac 

Apex Call Outs(Rest)

I am making an call out to a service,by hitting an url provided by mule,this service will return a pdf in base64encoded format, I am getting the below error 
Access control configuration prevents your request from being allowed at this time. Please contact your service provider....

Could anyone help how to resolve and acheieve this..


Thanks in Advance
 
s_macs_mac
This is the class I am using....
public class HttpCallout {

  public Blob basicCallout(){
  Http p = new Http();
 HttpRequest req = new HttpRequest();
 req.setEndpoint('http://10.201.xx..xxx:1024/res');
 
 req.setMethod('GET');
req.setHeader('content-type','application/pdf');


 HTTPResponse res = p.send(req);
String resbody= res.getBody();
system.debug('@@@@resbody@@@@'+resbody);

Blob beforeblob = res.getBodyAsBlob();

//string paramvalue = EncodingUtil.base64Encode(beforeblob);
String paramvalue = beforeblob.toString();
Blob afterblob = EncodingUtil.base64Decode(paramvalue);



 System.debug('is now decoded as: ' + afterblob.toString());
       

 return afterblob;
  }
 }
VineetKumarVineetKumar
Seems like there is some time restriction on the API call that you make. It's open for some limited time.