Project Description
POX.NET is a set of utility classes that assist in creating POX (Plain Old Xml) services and clients in .NET 2.0. This libary leverages classes within .NET 2.0 and does not require any additional add-ons. With POX.NET working with POX in .NET is a breeze.

For background of this project see the original blog post at http://blogs.msdn.com/gblock/archive/2007/01/22/pox-xmlhttp-in-net-2-0.aspx.

Sample POX Client / Service and test fixture are included in the source.

Mini QuickStart - Using POX.NET

POX.NET allows you to do two main things. 1. Create a POX client to invoke a POX service. 2. Create an ASP.NET POX service.

Invoking a POX service.

In order to invoke a POX Service using POX.NET you do 3 things:
  1. Create a POXClient instance
  2. Invoke the Post<T> method passing an Xml serializable object instance.
  3. Call GetResponse<T> and retrieve the response type.

The example below shows how to Invoke a POX service that accepts an Order object as part of the request, and retrieves an OrderResponse object as part of the response.

using Microsoft.POXUtils

public OrderResponse SubmitOrder(Order order)
{
    Order Order = new Order(1234);
    POXClient Client = new POXClient("http://Orders/SubmitOrder.aspx");
    Client.Post(order);
    return Client.GetResponse<OrderResponse>();
} 


Creating a POX Service

To create a POX service, follow the following steps:
  1. Add a new ASPX page in your web application which represents you service i.e. OrderService.aspx.
  2. Change the base class to inherit from POXPage.
  3. In the Page_Load event handler, call the GetRequest<T> method to retrieve the request object that the service has been passed as part of the invocation.
  4. Create your response object and call the WriteResponse<T> method.

The example shows how to create a POX service that receives the Order object posted in the client example, and returns an OrderResponse.

using Microsoft.POXUtils

class OrderService : POXPage {

    protected void Page_Load(object sender, EventArgs e)
    {
        Order CurrentOrder = GetRequest<Order>();
        if (CurrentOrder != null)
        {
            OrderResponse OrderResponse = new OrderResponse(CurrentOrder, "confirmed", "1000");
            WriteResponse(OrderResponse);
        }
    }
} 


What's included in the package?

Microsoft.POXUtils

Microsoft.POXUtils.Client

Provides a class which enscapsualtes a POX service invocation. The class exposes methods for posting and retreving Xml Serializable objects, streams and Xml Documents via a POX Service.

Microsoft.POXUtils.POXPage

Provides an inherited System.Web.UI.Page class that exposes methods for handling a POX web request and response.

Microsoft.POXUtils.Common

Handles low-level streaming, serialization and deserialization for Client and POXPage.

Releases

.1 Alpha - http://www.codeplex.com/POXNET/Release/ProjectReleases.aspx?ReleaseId=2183
.11 Alpha - http://www.codeplex.com/POXNET/Release/ProjectReleases.aspx?ReleaseId=2966