9.5. Handling XML Documents

While it's easy to return and receive DataSets from Web services, sending and receiving XML documents provides the most control over message format. In this section, I will show you how to return an XML document with a specific structure, perhaps based on a schema, like the SOAP message in Listing 9.15.

Listing 9.15. The desired SOAP message. The payload is an XML document fragment based on a predefined schema.
<soap:Envelope ...>
  <soap:Body>
    <CustomerData xmlns="http://www.LearnXmlWS.com/customerorders">
      <Customers CustomerID="ALFKI"
       CompanyName="Alfreds Futterkiste" />
       ...
      <Customers CustomerID="WOLZA"
                 CompanyName="Wolski  Zajazd" />
    </CustomerData>
  </soap:Body>
</soap:Envelope>

There are several steps you must ...

Get Real World XML Web Services: For VB and VB .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.