---
schema_version: "1"
id: 7c6a5b9a44d77e3ee8a0e80ea7a222d4d658a4ec02fcf01db5ae8b23395808b8
title: Create an Apex Class from a WSDL
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/code_wsdl_to_package.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.code_wsdl_to_package.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: bde06f6798981f52cce0eb07e0a0d4b7b9957e3ca3830347520805f520bb07a5
description: An Apex class can be automatically generated from a WSDL document that is stored on a local hard drive or network.
products:
  - Salesforce Platform
release: "264"
---
# Create an Apex Class from a WSDL

An Apex class can be automatically generated from a WSDL document that is stored on a local hard drive or network.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic (<a href="https://help.salesforce.com/s/articleView?id=xcloud.overview_edition_lex_only.htm&amp;type=5&amp;language=en_US" target="_blank">not available in all orgs</a>) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <span id="code_wsdl_to_package__Apex_Code_editions_text"><a name="code_wsdl_to_package__Apex_Code_editions_text"></a><strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, <strong>Developer</strong>, and <strong>Database.com</strong> Editions</span></td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:74%">
          <col style="width:26%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d19343e80">User
              Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d19343e80 ">
              <span id="code_wsdl_to_package__class_perm_text"><a name="code_wsdl_to_package__class_perm_text"><!-- --></a>To define, edit, delete, set security,
                and set version settings for Apex classes:</span>
            </td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d19343e80 ">
              <span id="code_wsdl_to_package__apex_perm_value"><a name="code_wsdl_to_package__apex_perm_value"><!-- --></a>Author Apex</span>
            </td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d19343e80 ">
              <span id="code_wsdl_to_package__class__runtest_perm_text"><a name="code_wsdl_to_package__class__runtest_perm_text"><!-- --></a>To run Apex tests:</span>
            </td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d19343e80 ">
              <span id="code_wsdl_to_package__apex_runtest_perm_value"><a name="code_wsdl_to_package__apex_runtest_perm_value"><!-- --></a>View Setup and
                Configuration</span>
            </td>

          </tr>
        </tbody>
      </table>

Creating a class by consuming a WSDL document allows developers to make callouts to the external Web service in their Apex.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_code-264-0-0-production-enus/789bc523-706b-4ae4-8fe9-be6322e38b6b/images/icon_note.png)

Note Use Outbound Messaging to handle integration solutions when possible. Use callouts to third-party Web services only when necessary.

1. In the application, from Setup, enter Apex Classes in the Quick Find box, then select **Apex Classes**.
2. Click **Generate from WSDL**.
3. Click **Browse** to navigate to a WSDL document on your local hard drive or network, or type in the full path. This WSDL document is the basis for the Apex class you are creating.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_code-264-0-0-production-enus/789bc523-706b-4ae4-8fe9-be6322e38b6b/images/icon_note.png)
    
    Note
    
    The WSDL document that you specify might contain a SOAP endpoint location that references an outbound port.
    
    For security reasons, Salesforce restricts the outbound ports you can specify to one of the following:
    
    - 80: This port only accepts HTTP connections.
    - 443: This port only accepts HTTPS connections.
    - 1024–66535 (inclusive): These ports accept HTTP or HTTPS connections.
4. Click **Parse WSDL** to verify the WSDL document contents. The application generates a default class name for each namespace in the WSDL document and reports any errors. Parsing fails if the WSDL contains schema types or constructs that aren’t supported by Apex classes, or if the resulting classes exceed the 1 million character limit on Apex classes. For example, the Salesforce SOAP API WSDL cannot be parsed.
5. Modify the class names as desired.
    
    While you can save more than one WSDL namespace into a single class by using the same class name for each namespace, Apex classes can be no more than 1 million characters total.
6. Click **Generate Apex**. The final page of the wizard shows which classes were successfully generated, along with any errors from other classes. The page also provides a link to view successfully generated code.

The successfully generated Apex classes include stub and type classes for calling the third-party Web service represented by the WSDL document. These classes allow you to call the external Web service from Apex. For each generated class, a second class is created with the same name and with a prefix of `Async`. The first class is for synchronous callouts. The second class is for asynchronous callouts. For more information, see the [Apex Code Developer's Guide](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/).

Note the following about the generated Apex:

- If a WSDL document contains an Apex reserved word, the word is appended with `_x` when the Apex class is generated. For example, `limit` in a WSDL document converts to `limit_x` in the generated Apex class. For a list of reserved words, see the [Apex Code Developer's Guide](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/).
- If an operation in the WSDL has an output message with more than one element, the generated Apex wraps the elements in an inner class. The Apex method that represents the WSDL operation returns the inner class instead of the individual elements.

#### See Also

- [Define Apex Classes](https://help.salesforce.com/s/articleView?id=platform.code_define_package.htm&release=264.0.0&type=5 "Salesforce stores Apex classes as metadata.")