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.
Best Answer
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