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.
- Download the Metadata WSDL
Setup, API, Generate Metadata WSDL. Save the XML file locally.
- Generate client code from the WSDL
Use wsimport (Java), svcutil (C#), or Apex''s WSDL2Apex (in Salesforce) to generate stub code from the WSDL.
- 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.
- Call Metadata API operations
Call retrieve, deploy, list, or describeMetadata via the generated client. Handle the async-status pattern for retrieve and deploy.
- 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.
- 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.
- 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.