Callout not allowed from this future method. Please enable callout by annotating the future method. eg: @Future(callout=true)

In this case, use
 @future(callout=true)  
    public static void post(String u, String p)
    {
        try
        {
            HttpRequest req = new HttpRequest();
            ............................................................                   
            Http http = new Http();
            HTTPResponse res = http.send(req);           
            System.debug('Response is ' + res.getBody());

            ..................................................................
            ..................................................................
            ..................................................................
        }
        catch(Exception e)
        {
            ..................................................................

            ..................................................................
        }
    }


Cheers!!! 

No comments:

Post a Comment