Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryWWebService Method
DevelopmentIntermediate

WebService Method

In Salesforce Apex, a method declared with the webservice keyword that exposes custom Apex logic as a SOAP web service endpoint, allowing external applications to call the method via the enterprise or partner WSDL.

§ 01

Definition

In Salesforce Apex, a method declared with the webservice keyword that exposes custom Apex logic as a SOAP web service endpoint, allowing external applications to call the method via the enterprise or partner WSDL.

§ 02

In plain English

👋 Study buddy

A WebService Method in Salesforce Apex is a method declared with the webservice keyword that exposes custom Apex logic as a SOAP web service endpoint. External applications can call it to invoke your custom code remotely.

§ 03

Worked example

scenario · real-world use

Daltrey Spices' Salesforce org has a few legacy SOAP integrations from external systems. A WebService Method like webservice static String getInventoryStatus(Id productId) { ... } exposes the Apex logic as a SOAP endpoint that external systems can call via the Enterprise WSDL. The integration partner generates Java client code from the WSDL, then calls getInventoryStatus(productId) from their Java code as if it were a local method. Modern integrations would use REST + Apex @RestResource, but the SOAP-based WebService Methods continue to work for existing partners and are still the only fit when the partner's systems are SOAP-only.

§ 04

Why WebService Method matters

In Salesforce Apex, a WebService Method is a method declared with the webservice keyword that exposes custom Apex logic as a SOAP web service endpoint, allowing external applications to call it via the Enterprise or Partner WSDL. This is the legacy approach to exposing custom logic; modern approaches use @RestResource annotated classes for REST endpoints.

WebService methods are SOAP-based and part of the older Salesforce integration model. For new development, @RestResource classes are preferred because REST is the modern standard. WebService methods remain relevant for maintaining legacy SOAP integrations.

§ 05

How organizations use WebService Method

TerraForm Tech

Maintains legacy WebService methods while building new endpoints with @RestResource.

CodeBridge

Teaches WebService methods for legacy context, recommending @RestResource for new work.

Quantum Labs

Uses @RestResource for all new custom API endpoints.

§

Trust & references

Official documentation

Straight from the source - Salesforce's reference material on WebService Method.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.
§

Test your knowledge

Q1. What is a WebService Method?

Q2. Is it the modern approach?

Q3. What keyword declares them?

§

Discussion

Loading…

Loading discussion…