function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amritesh SinghAmritesh Singh 

http post method 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

 

BinayakBinayak

You can at first login usinh OAuth .Get the access token.Then add this token in your header and make the rest call.