7

I am writing a REST service in apex, and getting the below error message.

<Errors>
<Error>
<errorCode>FORBIDDEN</errorCode>
<message>
You do not have access to the Apex class named: JobOrderFeedXML
</message>
</Error>
</Errors>

Basically, below is my class structure.

@RestResource(urlMapping='/myFeedXML/*')
global class myFeedXML 
{
    @HttpGet
    global static void doGet() 
    {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;

        //generate xml
        .....

        res.addHeader('Content-Type', 'text/xml');
        res.responseBody = Blob.valueOf(xmlOutput);
    }
}

Anything wrong with the code? Any input will be so helpful.

8

In the case of a Force.com Site the Apex class must be enabled on the special Guest profile associated with the site.

Setup > Develop > Sites > [your site label] > Public Access Settings > Enabled Apex Classes

  • 1
    Thanks for the detail info provided. It helps me a lot :D – kitokid Feb 6 '14 at 2:11
6

This is happening because your user (Profile of the User ) does not have access to the apex class.

Under profiles ,please give access to the myFeedXML class and should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.