# How to Use Apidog to Write SOAP API Documentation

SOAP (Simple Object Access Protocol) is a legacy but robust protocol for structured data exchange in web services. Built entirely on XML, SOAP APIs require precise documentation of their requests, responses, namespaces, and schemas—often defined in a WSDL (Web Services Description Language) file. While newer APIs have shifted to REST and JSON, SOAP remains critical for enterprise systems, financial services, and other security-heavy workflows.  

Documenting SOAP APIs, however, can be tricky due to XML’s verbosity and strict schema requirements. Tools like **Apidog**, designed for both REST and SOAP workflows, simplify this process. Let’s walk through how to use Apidog effectively for SOAP documentation.  

Here are several SOAP API documentations created by Apidog for reference:
- [WebService: Number To Words](https://apidocs.apidog.io/webservice-number-to-words-15125868e0.md)
- [SOAP: Add integers](https://apidocs.apidog.io/soap-add-integers-15125869e0.md)
- [SOAP/WSDL: Ebay](https://apidocs.apidog.io/soapwsdl-ebay-15125870e0.md)
- [Submit a purchase request](https://apidocs.apidog.io/submit-a-purchase-request-15123596e0.md)

---

### **Step 1: Create a New Project** 
   - Select **HTTP** as the project type (not "SOAP"—Apidog handles SOAP under HTTP).  
   - Name your project (e.g., "User Management SOAP API").  

### **Step 2: Add a SOAP Endpoint**  
   - Click **New Endpoint** within the project.  
   - Set the **URL** to your SOAP service endpoint (e.g., `https://api.example.com/soap-service`).  
   - Choose **POST** as the method (SOAP typically uses POST).  


### **Step 3: Configure XML for SOAP Requests**  
SOAP requires XML-formatted requests. In Apidog:  
1. **Set Headers**:  
   - Add the `Content-Type` header with value `text/xml` (or `application/soap+xml` for SOAP 1.2).  
   - Optionally include `SOAPAction` if your service requires it (e.g., `SOAPAction: getUserDetails`).  

2. **Define the XML Request Body**:  
   - In the **Body** tab, select **XML** (not JSON or Form Data).  
   - Write or paste your SOAP envelope structure. For example:  
     ```xml
     <soapenv:Envelope 
         xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:ex="http://example.com/ns">
         <soapenv:Header/>
         <soapenv:Body>
             <ex:getUserDetails>
                 <ex:userId>123</ex:userId>
             </ex:getUserDetails>
         </soapenv:Body>
     </soapenv:Envelope>
     ```  

### **Step 4: Use Apidog’s XML Schema Settings for Validation**  
Ensure your XML requests and responses adhere to SOAP’s strict standards with schema validation:  
1. Go to the **Schema** part in your endpoint.  
2. **Enable XML Settings** to define:  
<Background>
<p style="text-align:center">
    <img src="https://api.apidog.com/api/v1/projects/849209/resources/352673/image-preview" style="width:400px" />
</p>
</Background>

   - **Namespaces**: Declare prefixes like `soapenv` or `ex` and their URIs.  
   - **Elements**: Specify nested tags (e.g., `userId` as an integer inside `getUserDetails`).  
   - **Attributes**: Add validations for attributes like `status="pending"`.  

### **Step 5: Test and Validate SOAP Responses**  
Apidog lets you test your SOAP API and validate responses:  
1. Click **Send** to execute the request.  
2. The tool will:  
   - Highlight XML syntax errors.  
   - Validate the response against your schema (e.g., check if `email` is a string).  
   - Flag mismatches (e.g., missing `<name>` tag).  

### **Step 6: Auto-Generate Documentation**  
Once validated, Apidog compiles your SOAP API documentation with:  
- **Interactive XML examples** for requests/responses.  
- **Namespace and schema descriptions**.  
- **Shareable links** for team collaboration.  

---

### **Why Apidog Works for SOAP**  
- **HTTP Flexibility**: Treat SOAP endpoints like any HTTP API while leveraging XML-specific features.  
- **Precision**: Schema validation ensures your documentation matches the actual SOAP service behavior.  
- **Clarity**: Auto-generated docs reduce manual effort and human error.  

SOAP’s XML complexity doesn’t have to be a headache. With Apidog, you can document namespaces, schemas, and endpoints efficiently—whether you’re maintaining legacy systems or integrating with enterprise services.  

Start by creating an HTTP project, defining your SOAP endpoint, and letting Apidog handle the rest! 🎯
