Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
1  
Thanks for the detail info provided. It helps me a lot :D –  kitokid Feb 6 at 2:11
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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