function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sunny@99-chgsunny@99-chg 

Error: Method does not exist or incorrect signature: [http].send(System.HttpRequest)

Hai All,

      Now the Apex code is fine and working.

When iam modifying small change in apex code its showing an Error

 

Compile Error: Method does not exist or incorrect signature: [http].send(System.HttpRequest)

 


and my apex,what i wrote in my controller is

 

public string php(blob attpdf){


HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();

req.setEndpoint('https://sfarchive.com/generatePDF.php');
req.setMethod('POST');
req.setBodyasBlob(attpdf);
req.setCompressed(true); // otherwise we hit a limit of 32000

try {
res = http.send(req);       ------> here its showing error.
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.toString());
}
return null;
}

 

 

Can anyone tell me the solution...

 

bob_buzzardbob_buzzard

It might be just a naming clash - as http is both the type and the variable name, it may be that apex considers

 

http.send(req);

 

to be an attempt to access a static method on the http class.

 

Try changing your variable name to myHttp or similar.