Is it possible to expose a single method in salesforce and make it available via soap and rest? I am looking at the docs and seems like you can't. For example on this page: https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST

would i be able to do this? I am currently testing this out in dev org but wanted to see if anyone knew right away

  webService static List<Case> getOpenCases() {
    // some logic
    return cases;

1 Answer 1


Looks like you can expose the same apex method both via SOAP and REST API..I tried the below code and executed via SOAPUI(for SOAP protocol) and workbench(REST protocol) and it worked fine and the bebug statement printed in logs.

@RestResource(urlmapping = '/someUrl/*')
global class SOAPRESTClass {

    webservice static void someMethod(){
        System.debug('From someMethod');

  • Granted, that might have some unintended side effects, like if you need to accept some types of parameters. Overall, though, I love the efficiency of the design.
    – sfdcfox
    Sep 7, 2015 at 6:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .