+ Start a Discussion
Amritesh SinghAmritesh Singh 

Http post issue

Hi all

I have create the following Restfull  Http webservice in Apex



global class RESTCaseController {

global static String GetXml()
RestRequest req = RestContext.request;
RestResponse res = Restcontext.response;

blob Body = req.requestbody;
string str=body.toString();
catch(Exception E)
system.debug('ERROR :' +e.getMessage());

return null;


End Url :https://ap1.salesforce.com/services/apexrest/sfdcWebservice


But this url is not working.


I searched and found that some authentication is required.


what changes i have to make in the code and to my account 

so that external server will be able to post xml to my End url.


Pls help me


Authentication always required for handshake between two systems.

You definitely need to provide the Other system with "Consumer Key" and "Consumer Secret Key" to complete SF-authentication via oauth.net and subsequently request the REST resource.

This is well explained in the following article

You don't have to use authentication - if you want a public facing HTTP Post solution, you can just create a Force.com Site and add the Apex Rest Class to that Site's Profile as an available Apex Class. 

Amritesh SinghAmritesh Singh

Hi BoyinDC,


I am doing the same,made a public site and added my apex rest class in site's profile.But still url is not working.

I have upadated my url,as required when using sites.