Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Routing with Windows Communication Foundation : Part 1 - Overview

0.00/5 (No votes)
10 Mar 2008 1  
Using WCF to Route Older Communications

Introduction

WCF is a wonderful thing. It would be nice if we all had the time to go back and rewrite every service we have ever made using WCF. But often, this is not feasible. In which case, a WCF Proxy, or a WCF Router might be a good idea.

Background

This is the first of several articles walking through a WCF Router for an enterprise WCTP service. The sections are:

Part 1 - Overview
Part 2 - Extending web.config
Part 3 - Defining the Service Contracts
Part 4 - Implementing the Router
Part 5 - An Asynchronous Service Implementation
Part 6 - A Synchronous Service Implementation
Part 7 - Advanced Services

What is WCTP?

WCTP stands for Wireless Communications Transfer Protocol. It is an open standard located here. It predates WCF, and even SOAP Web Services. It uses XML defined in a DTD passed between client and server using HTTP POST. It is used for short data wireless services, typically in machine to machine (M2M) applications.

I am sure that most people reading this article won't be using WCTP anytime soon, but it is a good example of an older (but still used) protocol which the WCF programmer may need to make use of.

WCTP Addressing

With WCTP, there is typically a single point of entry from a wireless provider's network to a customer's network. A customer's network destination address is typically someaddress@contoso.com. With such an address, the wireless network will POST the WCTP XML document to http://wctp.contoso.com/wctp.

It is possible to use native WCTP routing by specifying the entire server address in the WCTP address, like someaddress@wctp.contoso.com/MyWCTPService/WctpReceive.ashx. Then you could implement another WCTP service by using someaddress@wctp.contoso.com/MyOtherWCTPService/WctpReceive.ashx.

However, WCTP is for short data M2M services, and the additional address passed across the wireless network becomes significant when the actual body of the message from the wireless device is very small. And so this would adversely affect the bills received by the customer.

Router Design

So what we want, then, is to build a router for WCTP traffic. Something that would look something like this diagram.

WCTP_Overview.png

The processing follows this general flow:

  1. A wireless network provider POSTs a WCTP XML document through the Internet to the WCTP Router.
  2. The WCTP Router processes the XML document
  3. Using some routing rules, the WCTP Router passes the data contained in the original WCTP Document to zero or more Services using WCF.

Like WCF, a goal of this router is that the routing rules are defined at runtime via the standard XML configuration file and no modifications to the source are necessary to add, remove, or change a service.

Continue to Part 2 - Extending web.config

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here