XML • Generate SOAP Request/Response Messages

Listing 1. The Web Services Definition Language (WSDL) document for the Lists Web service's GetListItems Web method defines these SOAP request and response messages, which return the rows from a SharePoint list of Northwind customers. VB.NET procedural code transforms the response message's payload to populate a DataTable that serves as the DataGrid's RecordSource.

<!-- SOAP request message -->
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope 
      xmlns:soap="http://schemas.xmlsoap.org/
         soap/envelope/" 
      xmlns:xsi="http://www.w3.org/2001/
         XMLSchema-instance" 
      xmlns:xsd= 
         "http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetListItems 
            xmlns="http://schemas.microsoft.com/
               sharepoint/soap/">
         <listName>{418D6B7D-27BD-48F6-A0A1-
               C851FBBEDFE4}</listName>
         <viewName />
         <rowLimit>100</rowLimit>
      </GetListItems>
   </soap:Body>
</soap:Envelope>

<!-- SOAP response message -->
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope 
      xmlns:soap= 
         "http://schemas.xmlsoap.org/soap/
         envelope/" 
      xmlns:xsi="http://www.w3.org/2001/
         XMLSchema-instance" 
      xmlns:xsd= 
         "http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetListItemsResponse 
            xmlns="http://schemas.microsoft.com/
               sharepoint/soap/">
         <GetListItemsResult>
            <listitems 
             xmlns:s="uuid:BDC6E3F0-6DA3-11d1-
               A2A3-00AA00C14882"
             xmlns:dt="uuid:C2F41010-65B3-11d1-
               A29F-00AA00C14882"
             xmlns:rs="urn:schemas-microsoft-
               com:rowset" 
             xmlns:z="#RowsetSchema">
               <rs:data ItemCount="91">
                  <z:row ows_CustomerID="ALFKI" 
                     ows_CompanyName="Alfreds 
                        Futterkiste" 
                     ows_ContactName="Maria 
                        Anders" 
                     ows_ContactTitle="Sales 
                        Representative" 
                     ows_Address="Obere Str. 
                        57" 
                     ows_City="Berlin" 
                     ows_PostalCode="12209" 
                     ows_Country="Germany" 
                     ows_Phone="030-0074321" 
                     ows_Fax="030-0076545" 
                     ows_ID="1" ows_owshidden-
                        version="10" />
   <!-- Remaining items removed for brevity -->
               </rs:data>
            </listitems>
         </GetListItemsResult>
      </GetListItemsResponse>
   </soap:Body>
</soap:Envelope>