title: WCF: Individual methods or a generic ProcessMessage method accepting xml
body: <p>My company is developing  an application that receives data from another company via TCP sockets and xml messages.  This is delivered to a single gateway application which then broadcasts it to multiple copies of the same internal application on various machines in our organisation.</p>
  
  <p>WCF was chosen as the technology to handle the internal communications (internally bi-directional).  The developers considered two methods.</p>
  
  <ol>
  <li><p>Individual methods exposed by the
  WCF service for each different
  message received by the gateway
  application.  The gateway
  application would parse the incoming
  external message and call the
  appropriate WCF service method.  The
  incoming XML would be translated
  into DataContract DTO’s and supplied
  as argument to the appropriate WCF
  method.</p></li>
  <li><p>The internal application
  exposed  a WCF service with one
  method “ProcessMessage” which
  accepted an Xml string message as
  argument.  The internal app would
  parse then deserialize the received
  xml and process it accordingly.</p></li>
  </ol>
  
  <p>The lead developer thought option two was the better option as it was “easier” to serialized/deserialize the xml.  I thought the argument didn’t make sense because DataContracts are serialized and deserialized by WCF and by using WCF we had better typing of our data.  In option 2 someone could call the WCF service and pass in any string.  I believe option 1 presents a neater interface and makes the application more maintainable and useable.</p>
  
  <p>Both options would still require parsing  and validation of the original xml string at some point, so it may also be a question where is the recommended place to perform this validation.</p>
  
  <p>I was wondering what the current thoughts are for passing this kind of information and what people’s opinions on both alternatives are.  </p>