title: How to create WCF service from XSD files and service contract programmatically?
body: <p>I've already posted this topic several times, but no luck. I'll try again.</p>
  
  <p>We have a project where we should create WCF service based on XSD files we get from our client and fixed service contract that looks as following:</p>
  
  <p>Message CustomAction(Message inputMessage);</p>
  
  <p>So, the operation will be the same, but XSD files will change.</p>
  
  <p>All that we should do programmatically.</p>
  
  <p>Here are my questions:</p>
  
  <p>1) How to programmatically create WSDL file from XSD files knowing how service would look like (see above)?</p>
  
  <p>2) How to use WSDL file generated in 1) to create WCF service programmatically?</p>
  
  <p>3) How to read the body of input/request and output/response SOAP messages from the service above?</p>
  
  <p>There is more than 1 approach and I don't know which one is right. I'm not close to solution.</p>
  
  <p>There's an approach to write WSDL file programmatically using ServiceDescription class, but it's complicated, how to do it correctly, what to do after creation of WSDL file, etc.</p>
  
  <p>There's an approach to use IXmlSerializable interface, but I don't need to create C# types because I only have XSD files. Everything should be done programmatically.</p>
  
  <p>I suppose I should use raw messages, but how to connect that approach with existing XSD files from which I should create WSDL file and how to pass that WSDL file to... where?</p>
  
  <p>Thank you in advance.</p>
  
  <p>Regards,</p>
  
  <p>Goran</p>