none
Should WCF services return metadata? RRS feed

  • General discussion

  • In wcf I send a request to the service and use the decorator pattern to pass the request through a number of cross cutting concerns. Many of these concerns can fail and negate the request. It is a per call service. My question is whether it is good design practice to have wcf send back meta data. I ended up making all my classes send back a generic "StandardResponse<T>" class that looks something like this:

    StandardResponse<T>

    {

    public ResponseType Response { get; set; }

    public string Message { get; set; }

    public T ResponseData { get; set; }

    public T UserSubmittedData { get; set; }

    public T StoreRetrievedData {get; set; }

    }

    where ResponseType is an enum that informs the client what kind of response ended up getting returned. For instance, ResponseType { NotAuthorized, NotValidData, SyncRequired, ... etc.}

    I keep getting the sense this is really terrible design but I can't put my finger on what is wrong with it. I need a total rebuke or a total confidence boost on this. Lend me your hand, please. Thanks in advance.


    • Edited by crushbrain Wednesday, August 7, 2013 11:21 AM
    Wednesday, August 7, 2013 11:20 AM

All replies

  • Hi,

    the very first line that you wrote : "In wcf I send a request to the service" , you can not make a request to service without having any proxy, and you can not have a proxy object without having metadata exposed by WCF.

    So, it is mandatory to publish/expose metadata to outside world.



    One good question is equivalent to ten best answers.

    Wednesday, August 7, 2013 11:41 AM