1

here is my APEX REST class code

@RestResource(urlMapping='/CallREST1')

global with sharing class CallREST { @HttpPost global static String createNewCase(String companyName) { System.debug('COMPANY: '+companyName); return 'done'; } }

my HTTP request code is


HttpRequest req = new HttpRequest();
req.setHeader('Authorization', 'OAuth ' + accessToken);
req.setHeader('Content-Type','application/json');
req.setHeader('accept','application/json');
 req.setEndpoint(instance_url+'/services/apexrest/CallREST1');
 req.setBody('{"companyName":"GenePoint"}');
 req.setMethod('POST');
 HttpResponse res =new Http().send(req);

please point me out where i am wrong.. i don't have any namespace, package name. i have tried with appending Organization name or Organization ID , as i found from somewhere to try all this things.. any help is appreciated.

9
  • are you calling WebService from same Org to same Org? Commented Jan 31, 2014 at 8:32
  • @Ganesh i am calling REST web service from other org.
    – Ankuli
    Commented Jan 31, 2014 at 9:11
  • Check the authorization header that should be Bearer ACCESSTOKEN Commented Jan 31, 2014 at 9:27
  • Check whats the variable instance_url is returning? Commented Jan 31, 2014 at 9:34
  • @MartinBorthiry, I have tried with Bearer also. but it didn't worke,same issue again.
    – Ankuli
    Commented Jan 31, 2014 at 9:47

1 Answer 1

3

This is a known issue. According to Rich Unger, the solution may be to "Run All Tests" or click the "Compile All Classes" link in the Apex class list. Take a look at this blog post and the comments at the bottom of the page for more info.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .