SOAP Basics

SOAP protocol structure and web services.

SOAP Message Structure

Basic SOAP Envelope
 version="1.0"?>

  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  
    
  
  
    
  

SOAP Request Example

Get user request
 ...>
  
    
      xmlns:m="http://www.example.com/user">
      123
    
  


HTTP POST to endpoint
POST /UserService
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.example.com/GetUser"

SOAP Response Example

Successful response
 ...>
  
    
      xmlns:m="http://www.example.com/user">
      
        123
        John Doe
        [email protected]
      
    
  

SOAP Fault (Error)

Error response structure
 ...>
  
    
      soap:Client
      Invalid user ID
      
        
          USER_NOT_FOUND
          User with ID 123 not found
        
      
    
  


Fault codes
soap:Client // Client error
soap:Server // Server error