title: .NET 3.5 ASMX Web Service - Invoked via .NET 3.5 Service Reference - Common Class Reuse
body: <p>I have a .NET 3.5 web service with a single web method that looks something like this:</p>
  
  <pre><code>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  using System;
  using System.Collections.Generic;
  using System.Web.Services;
  
  namespace Webservice1
  {
      [WebService(Namespace = "http://tempuri.org/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      [System.ComponentModel.ToolboxItem(false)]
      public class WebService1 : WebService
      {
          [WebMethod]
          public List&lt;Model.Person&gt; HelloWorld()
          {
              var person1 = new Model.Person { FirstName = "Champa", LastName = "Chameli", TimeSpan = new TimeSpan(12,10,9,8)};
              var person2 = new Model.Person { FirstName = "Shamu", LastName = "Ramu", TimeSpan = new TimeSpan(12,10,9,8) };
              var persons = new List&lt;Model.Person&gt; { person1, person2 };
              return persons;
          }
      }
  }
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  using System.Runtime.Serialization;
  namespace Model
  {
      [DataContract]
      public class Person
      {
          [DataMember]
          public string FirstName{ get; set; }
          [DataMember]
          public string LastName { get; set; }
          [DataMember]
          public System.TimeSpan TimeSpan { get; set; }
      }
  }
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  </code></pre>
  
  <p>The Person class is defined in a common .NET 3.5 assembly that is also available (as a project reference) to a .NET 3.5 application that calls the webservice via a Service Reference (not a .NET compatibility web reference).</p>
  
  <p>The issue is that the service reference namespace contains its own, auto generated, implementation of Person. So the auto generated Service Reference method, available on the proxy SOAP client, has the following signature:</p>
  
  <pre><code>public WebApplication1.WebServiceReference1.Person[] HelloWorld()
  </code></pre>
  
  <p>I also tried using the svcutil command with the dataContractOnly option but I get the error </p>
  
  <blockquote>
    <p>"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\svcutil"
    http:///CrossfirePortalServices/Leasing/WebService1.asmx
    /o:"C:\temp\WebApplication1\WebApplication1\WebService1.cs" /s
    /tcv:Version35 /r:"c:\temp\WebApplication1\Model\bin\Debug\Model.dll"
    /language:C# /n:*,RPCommonClasses.Services.WebService1
    /dataContractOnly</p>
    
    <p>Error: The input read from
    'http:///CrossfirePortalServices/Leasing/WebService1.asmx'
    is inconsistent with other options. If you would like more help, type
    "svcutil /?"</p>
  </blockquote>
  
  <p>I am keen to find a solution where I can use Model domain throughout the entire framework rather than having to translate the different types in the Model domain to the different types in the ServiceReference domain for requests and vice versa for responses.</p>
  
  <p>Also we cannot change asmx webservices to WCF since our IT department is against it. Any suggestions on how I can accomplish this task? </p>