Back in Action

It’s been over a year since the last time I wrote a blog post. Been living WCF 24/7 since then and people keep telling me to start blogging again. So today, I’m finally going to give in.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

2 Responses to “Back in Action”

  1. Jeff 12 May 2010 at 11:16 pm #

    Jesse,

    I'm in a real bind. For reasons outside of my control, I need to deploy a WCF, IIS-hosted service that is really a simple router for untyped XML messages delivered via an HTTP POST over SSL. There are hundreds of legacy "clients" deployed that must be protected. They simply call the existing "service" as content-type: application/xml, text/xml or text/plain…and deliver a simple XML body (content irrelevant to the service) with no SOAP or other wrapper/envelope content.

    I'm a complete .NET novice and come from the JAVA world. When I open VS 2008 or 2010, I don't know even where to begin. Every availble template seems to assume a serializable contract between a client (under author's control) and the service. I have no control over the clients and there is no serialization of objects here.

    I could use some help but I'm bewildered trying to grasp C#, VS, .Net framework and WCF with few roadmaps to doing something that seems so simple if built from scratch using basic http/network functionality.

    I could use a template, solid guidance or a few hours of consulting support! Please.

  2. jezell 13 May 2010 at 8:37 am #

    In order to route raw traffic, you will need to set up a contract to send and receive the WCF Message class with request and reply actions set to "*".

    public interface IRequestReceiver
    {
    [OperationContract(Action="*", ReplyAction="*")]
    Message Receive(Message message);
    }

    On the service implementation class, set the AddressFilterMode attribute to Prefix to tell the service if you would like to be able to receive messages at any path below the address used by the service host instead of only at the specified url.

    Use a custom binding with WebMessageEncoder and HttpTransport on your service host and outgoing endpoints. If you want to force all traffic to be raw message data rather than validating the messages as XML, add a custom WebContentTypeMapper that always returns WebContentFormat.Raw.

    For each received message, you can use HttpRequestMessageProperty.Name to look up HTTP specific details such as the query string. The received message can be send to the destination endpoint by using a ChannelFactory<IRequestChannel> to create a request channel with the same custom binding used by the request service.


Leave a Reply