Click here to Skip to main content
15,891,136 members
Articles / Web Development / ASP.NET

Having Fun with the XmlSchemaProvider: Serializing Object Trees

Rate me:
Please Sign up or sign in to vote.
4.85/5 (11 votes)
9 May 20063 min read 77.6K   532   25  
Learn how to serialize object trees into SOAP and back again
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using Library;

[WebService(Namespace = "http://diveinit.nl/schemas/test")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public Order GetOrder(int id) {
        Order o = new Order(id);
        o.Products.Add(new Product(1, "Product1"));
        o.Products.Add(new Product(2, "Product2"));
        o.Products.Add(new Product(3, "Product3"));
        return o;
    }

    [WebMethod]
    public Product GetProduct()
    {
        return new Product(1, "Product1");
    }
    
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Web Developer Code Counsel
Netherlands Netherlands
Wouter van Vugt is a Microsoft MVP with Office Open XML technologies and an independent consultant focusing on creating Office Business Applications (OBAs) with SharePoint, the Office 2007 system and related .NET technologies. Wouter is a frequent contributor to developer community sites such as OpenXmlDeveloper.org and MSDN and has published several white papers and articles as well a book available on line titled Open XML: the markup explained. Wouter is the founder of Code-Counsel, a Dutch company focusing on delivering cutting-edge technical content through a variety of channels. You can find out more about Wouter by reading his blog and visiting the Code-Counsel Web site.

Comments and Discussions