Note that there are some explanatory texts on larger screens.

plurals
  1. POSOA, Request/Response service layer, accepting and returning a request/response vs an array or requests/responses?
    primarykey
    data
    text
    <p>We are implementing a <a href="http://davybrion.com/blog/2009/11/requestresponse-service-layer-series/" rel="nofollow">Request/Response Service Layer</a> using WCF, where every request inherits from a base Request class and every response inherits from base Response class. </p> <p>The service has a single Process method, which accepts a Request and returns a Response.</p> <pre><code>// Messages contract public abstract class Request {} public abstract class Response {} // Operation contract Response Process(Request request); </code></pre> <p>However certain members of our team are of the opinion that instead of the operation contract expecting and returning a single request/response, it should accept and return an array of requests/responses.</p> <pre><code>// Operation contract Response[] Process(Request[] requests); </code></pre> <p>Personally I do not find it correct semantically and in cases where a collection of related requests are required to be processed at once (perhaps in a batch), would consider introducing BatchRequest and a BatchResponse messages.</p> <pre><code>public class BatchRequest : Request { public Request[] Requests {get;set;} } public class BatchResponses : Response { public string BatchReference {get; set;} // for example public Response[] Responses {get;set;} } </code></pre> <p>To me accepting and returning an array does not seem correct and this is certainly a pattern I've not seen used anywhere. Is there something more wrong with this? If yes, what is it?</p> <p>Some people feel that accepting/returning arrays would allow us to not have the extra complexity of introducing batch requests (like the one illustrated above), and that you could send a single request in the array anyways.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload