URIs and WCF Transport Channels

Link. February 20, 2007. Comments [1]. Posted in: WCF

One of the issues I've been struggling with while writing my experimental Windows Communication Foundation transport channel has been designing a proper URL syntax for the transport.

If you're writing a channel for a protocol that has a standard URI syntax (such as HTTP or FTP), then you won't have to worry about this at all. Otherwise, you need to give some thought as to what URI scheme you'll use, as the use of URIs (and in many cases, specifically URLs) to address endpoints is required in WCF, as Kenny Wolf mentioned in a past article.

If your protocol has an obvious, explicit addressing scheme, then this might not be too big a deal, as your URI syntax will likely derive easily from that. For example, for MSMQ, your addresssing will be based on referencing machines and queue names, so that's a good place to start from.

The reason I'm struggling a bit with this is that the protocol I want to work has these particularities:

  1. It does not have an obvious addressing scheme. By this I mean that just addressing, say, a host name, port and resource name is not enough to successfully open a transport connection.
  2. There are several important fields or properties the developer needs to specify for the transport to be able to open a connection. However, it also has quite a few fields that, while optional, it would be desirable for the developer to be able to set them (and even be encouraged to do so). What's worse, some of the required fields have optional, list-like components that are important to support.
  3. The basic information needed to open a connection to a remote endpoint is not composed of the same set of fields needed to define a local endpoint for receiving messages, which means that it would be very likely that the URI scheme would need to be different for the sending and receiving sides of the transport channel. This is due to a basic assymmetry at the protocol level that I can't avoid.

Regarding 1 and 2 above, the basic issue I struggle with is: How much information should go into the URI syntas versus other means, such as the Binding configuration element for the transport channel?

Problem 3 is a bit more annoying because it just doesn't quite feel right to have the same transport channel dealing with two different URI syntaxes but sharing a single URI scheme.

Does anyone have any good suggestions or rules of thumb for dealing with stuff like this?



Wednesday, February 21, 2007 11:36:20 AM (SA Pacific Standard Time, UTC-05:00)
The address element can take a set of extra headers-- see EndpointAddress.Headers. These headers can also be passed in as part of the config object model. This feature exists to handle scenarios like yours. The URI should contain enough information to hit the endpoint.

What I'm trying to get at is that you don't need to encode everything in the URI-- you have headers as well. As for asymmetry in the URI scheme, what you need to do is tell any clients, via policy and WSDL, how to connect to your endpoint. So long as you can express that asymettry in a way that the client can work with it with no ill effects, you should be fine.
Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Categories

Statistics

Total Posts: 1051
This Year: 2
This Month: 2
This Week: 1
Comments: 827

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.2.8279.16125

Sign In