---
schema_version: "1"
id: 71a28213b7c6db79f97999af09c314e4146f8fa548741fa21141773b0062afc4
title: Webservice Methods
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_web_services_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_web_services_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: f1dda536c9e42c7a47d7e8e9a83c03074fc2e2435eff03f612ec690742820dde
---
# Webservice Methods

Apex class methods can be exposed as custom SOAP Web service calls. This allows an external application to invoke an Apex Web service to perform an action in Salesforce. Use the webservice keyword to define these methods. For example:

global with sharing class MyWebService {
    webservice static Id makeContact(String contactLastName, Account a) {
        Contact c = new Contact(lastName = contactLastName, AccountId = a.Id);
        insert as user c;
        return c.id;
    }
}

A developer of an external application can integrate with an Apex class containing webservice methods by generating a WSDL for the class. To generate a WSDL from an Apex class detail page:

1. In the application from Setup, enter “Apex Classes” in the Quick Find box, then select **Apex Classes**.
2. Click the name of a class that contains webservice methods.
3. Click **Generate WSDL**.