Request/Response pattern in SOA implementation

Posted by UserControl on Stack Overflow See other posts from Stack Overflow or by UserControl
Published on 2010-06-16T07:17:38Z Indexed on 2010/06/16 7:22 UTC
Read the original article Hit count: 163

Filed under:
|
|

In some enterprise-like project (.NET, WCF) i saw that all service contracts accept a single Request parameter and always return Response:

[DataContract]
public class CustomerRequest : RequestBase {
        [DataMember]
        public long Id { get; set; }
}

[DataContract]
public class CustomerResponse : ResponseBase {
        [DataMember]
        public CustomerInfo Customer { get; set; }
}

where RequestBase/ResponseBase contain common stuff like ErrorCode, Context, etc. Bodies of both service methods and proxies are wrapped in try/catch, so the only way to check for errors is looking at ResponseBase.ErrorCode (which is enumeration).

I want to know how this technique is called and why it's better compared to passing what's needed as method parameters and using standard WCF context passing/faults mechanisms?

© Stack Overflow or respective owner

Related posts about best-practices

Related posts about wcf