Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Metadata WSDL entry
How-to guide

Use the Metadata WSDL in a custom integration

Most modern Salesforce deployment work doesn''t require touching the Metadata WSDL directly. Use it when building custom integration tools or extending Apex with metadata operations.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 21, 2026

Most modern Salesforce deployment work doesn''t require touching the Metadata WSDL directly. Use it when building custom integration tools or extending Apex with metadata operations.

  1. Download the Metadata WSDL

    Setup, API, Generate Metadata WSDL. Save the XML file locally.

  2. Generate client code from the WSDL

    Use wsimport (Java), svcutil (C#), or Apex''s WSDL2Apex (in Salesforce) to generate stub code from the WSDL.

  3. Authenticate against the org

    Use the Partner WSDL''s login operation to get a session ID. Include the session ID in the Metadata WSDL SOAP header.

  4. Call Metadata API operations

    Call retrieve, deploy, list, or describeMetadata via the generated client. Handle the async-status pattern for retrieve and deploy.

  5. Or use the Salesforce CLI

    For most use cases, the Salesforce CLI is the simpler choice. It wraps both the SOAP and REST Metadata APIs and handles authentication automatically.

  6. Refresh the WSDL per release

    Salesforce ships new metadata types each release. Re-download the WSDL periodically to pick up the new types in your generated client code.

Gotchas
  • The Metadata WSDL is versioned. Mixing WSDL versions with target org API versions causes silent failures or missing types.
  • Authentication uses SessionId, not OAuth. The Partner WSDL provides login; the session works for both Partner and Metadata operations.
  • Most modern work uses the Salesforce CLI instead of direct WSDL integration. The CLI handles authentication and async-status patterns automatically.
  • Apex WSDL2Apex is heap-intensive for large WSDLs. The Metadata WSDL imports into Apex but the generated class is hundreds of KB; test the import before relying on it in production.

See the full Metadata WSDL entry

Metadata WSDL includes the definition, worked example, deep dive, related terms, and a quiz.