title: .NET SVCUTIL does not generate namespaces properly
body: <p>I have a WSDL document with 2 namespaces, and I am trying to generate proxy classes using SVCUTIL.EXE. For some reason, in the generated code the types get placed into default namespace, not in the correct name for mapping provided.</p>
  
  <p>Here is my WSDL:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;wsdl:definitions name="TestService" 
      targetNamespace="My.Namespace.1" 
      xmlns:ns1="http://schemas.xmlsoap.org/soap/http" 
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
      xmlns:tns="My.Namespace.1" 
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;wsdl:types&gt;
          &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="My.Namespace.1" xmlns:ns1="My.Namespace.2" xmlns:tns="My.Namespace.1" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
              &lt;xs:import namespace="My.Namespace.2"/&gt;
  
              &lt;xs:element name="TestOpRequest" type="tns:TestOpRequest"/&gt;
              &lt;xs:element name="TestOpResponse" type="tns:TestOpResponse"/&gt;
  
              &lt;xs:complexType name="TestOpRequest"&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element ref="ns1:Type1"/&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
  
              &lt;xs:complexType name="TestOpResponse"&gt;
                  &lt;xs:sequence&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
  
          &lt;/xs:schema&gt;
          &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="My.Namespace.2" xmlns:tns="My.Namespace.2" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
              &lt;xs:element name="Type1" type="tns:Type1"/&gt;
  
              &lt;xs:complexType name="Type1"&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element name="prop1" type="xs:string"/&gt;
                      &lt;xs:element name="prop2" type="xs:string"/&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
  
          &lt;/xs:schema&gt;
      &lt;/wsdl:types&gt;
  
      &lt;wsdl:message name="testOp"&gt;
          &lt;wsdl:part element="tns:TestOpRequest" name="parameter"/&gt;
      &lt;/wsdl:message&gt;
  
      &lt;wsdl:message name="testOpResponse"&gt;
          &lt;wsdl:part element="tns:TestOpResponse" name="parameter"/&gt;
      &lt;/wsdl:message&gt;
  
      &lt;wsdl:portType name="TestService"&gt;
          &lt;wsdl:operation name="testOp"&gt;
              &lt;wsdl:input message="tns:testOp" name="testOp"/&gt;
              &lt;wsdl:output message="tns:testOpResponse" name="testOpResponse"/&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:portType&gt;
  
      &lt;wsdl:binding name="TestServiceSoapBinding" type="tns:TestService"&gt;
          &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;wsdl:operation name="testOp"&gt;
              &lt;soap:operation soapAction="" style="document"/&gt;
              &lt;wsdl:input name="testOp"&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output name="testOpResponse"&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:service name="TestService"&gt;
          &lt;wsdl:port binding="tns:TestServiceSoapBinding" name="TestServicePort"&gt;
              &lt;soap:address location="http://localhost/TestService"/&gt;
          &lt;/wsdl:port&gt;
      &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>Here is how I generate proxies:</p>
  
  <p>SvcUtil.exe /t:code test.wsdl /n:My.Namespace.1,Test.Namespace1   /n:My.Namespace.2,Test.Namespace2 /o:Test.cs</p>
  
  <p>Here is what gets generated:</p>
  
  <pre><code>/// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace="My.Namespace.1")]
  public partial class TestOpRequest
  {
  
      private Type1 type1Field;
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute(Namespace="My.Namespace.2", Order=0)]
      public Type1 Type1
      {
          get
          {
              return this.type1Field;
          }
          set
          {
              this.type1Field = value;
          }
      }
  }
  
  /// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace="My.Namespace.2")]
  public partial class Type1
  {
  
      private string prop1Field;
  
      private string prop2Field;
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute(Order=0)]
      public string prop1
      {
          get
          {
              return this.prop1Field;
          }
          set
          {
              this.prop1Field = value;
          }
      }
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute(Order=1)]
      public string prop2
      {
          get
          {
              return this.prop2Field;
          }
          set
          {
              this.prop2Field = value;
          }
      }
  }
  
  /// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace="My.Namespace.1")]
  public partial class TestOpResponse
  {
  }
  namespace Test.Namespace1
  {
  
  
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ServiceModel.ServiceContractAttribute(Namespace="My.Namespace.1", ConfigurationName="Test.Namespace1.TestService")]
      public interface TestService
      {
  
          // CODEGEN: Generating message contract since the operation testOp is neither RPC nor document wrapped.
          [System.ServiceModel.OperationContractAttribute(Action="", ReplyAction="*")]
          [System.ServiceModel.XmlSerializerFormatAttribute()]
          Test.Namespace1.testOpResponse testOp(Test.Namespace1.testOp request);
      }
  
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
      [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
      public partial class testOp
      {
  
          [System.ServiceModel.MessageBodyMemberAttribute(Namespace="My.Namespace.1", Order=0)]
          public TestOpRequest TestOpRequest;
  
          public testOp()
          {
          }
  
          public testOp(TestOpRequest TestOpRequest)
          {
              this.TestOpRequest = TestOpRequest;
          }
      }
  
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
      [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
      public partial class testOpResponse
      {
  
          [System.ServiceModel.MessageBodyMemberAttribute(Name="TestOpResponse", Namespace="My.Namespace.1", Order=0)]
          public TestOpResponse TestOpResponse1;
  
          public testOpResponse()
          {
          }
  
          public testOpResponse(TestOpResponse TestOpResponse1)
          {
              this.TestOpResponse1 = TestOpResponse1;
          }
      }
  
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      public interface TestServiceChannel : Test.Namespace1.TestService, System.ServiceModel.IClientChannel
      {
      }
  
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      public partial class TestServiceClient : System.ServiceModel.ClientBase&lt;Test.Namespace1.TestService&gt;, Test.Namespace1.TestService
      {
  
          public TestServiceClient()
          {
          }
  
          public TestServiceClient(string endpointConfigurationName) : 
                  base(endpointConfigurationName)
          {
          }
  
          public TestServiceClient(string endpointConfigurationName, string remoteAddress) : 
                  base(endpointConfigurationName, remoteAddress)
          {
          }
  
          public TestServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                  base(endpointConfigurationName, remoteAddress)
          {
          }
  
          public TestServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                  base(binding, remoteAddress)
          {
          }
  
          [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
          Test.Namespace1.testOpResponse Test.Namespace1.TestService.testOp(Test.Namespace1.testOp request)
          {
              return base.Channel.testOp(request);
          }
  
          public TestOpResponse testOp(TestOpRequest TestOpRequest)
          {
              Test.Namespace1.testOp inValue = new Test.Namespace1.testOp();
              inValue.TestOpRequest = TestOpRequest;
              Test.Namespace1.testOpResponse retVal = ((Test.Namespace1.TestService)(this)).testOp(inValue);
              return retVal.TestOpResponse1;
          }
      }
  }
  </code></pre>
  
  <p>Here is what I need to generate:</p>
  
  <pre><code>namespace Test.Namespace2
  {
      public partial class Type1
      {
          ....
      }
  }
  
  namespace Test.Namespace1
  {
      public partial class TestOpRequest
      {
          private Test.Namespace2 type1Field;
          ...
      }
  
      public partial class TestOpResponse
      {
      }
  
      public interface TestService
      {
          Test.Namespace1.testOpResponse testOp(Test.Namespace1.testOp request);
      }
  
      public partial class testOp
      {
          ...
      }
  
      public partial class testOpResponse
      {
          ...
      }
  
  }
  </code></pre>
  
  <p>Any suggestions will be appreciated.</p>