I'm writing a webservice from Salesforce that I can call from an external system, but for my life I cannot remember/find how to successfully call it. I am using a website in order to test the dummy service I created: http://resttesttest.com/


global with sharing class MyServices
    global static String createCase(String pCode, String rType, String subject, String description, String lookupInfo, String aaNum)
      return 'success';

What is the minimum info I must put into my call to make this work, or am I going about this completely wrong?

EDIT: I added @RestResource and set up a connected App in my Salesforce org now.

  • So how did it go? Does it work?
    – MnZ
    Jul 23, 2014 at 16:30
  • Looks like you are mixing and matching Web Services (SOAP) and REST - I would look at the REST Examples for HTTPPOST, and start from there - you also need to decide how you plan to pass in the data - as URL params, or as a JSON boy? Jul 23, 2014 at 16:35
  • Probably prefer JSON. Just got back from lunch so I'll try to get it working some more now.
    – dphil
    Jul 23, 2014 at 17:26

1 Answer 1


By using the webservice key word you are creating something that is to be exposed through SOAP. You can select the class and use the "Generate WSDL" button to generate the WSDL that external tooling can consume.

If you want to avoid SOAP and WSDL, then make use of the @RestResource annotation instead. This also allows the content to be in JSON format which is generally easy for clients (including JavaScript apps running in the browser) to create and consume.

Note that in both cases the request will have to include some authentication information (see e.g. OAUTH). (But also see BritishBoyinDC's comment.)

  • 2
    Just to clarify - you can call a REST service without authentication...you just have to expose it via the Apex Classes on the guest user profile Jul 23, 2014 at 16:20

You must log in to answer this question.

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