+ Start a Discussion
Amritesh SinghAmritesh Singh 

Http post issue

Hi all

I have create the following Restfull  Http webservice in Apex

 

RestResource(urlMapping='/sfdcWebservice/*')

global class RESTCaseController {

@HttpPost
global static String GetXml()
{
try
{
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

 

bvramkumarbvramkumar
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
http://danlb.blogspot.in/2010/10/salesforcecom-rest-api.html
BritishBoyinDCBritishBoyinDC

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.