title: Visual Studio 2008 web reference proxy class doesn't decode xml attribute
body: <p>I have a following issue:</p>
  
  <p>I am writing client code for consumation of a web service. Here is the answer from the web service:</p>
  
  <pre><code>HTTP/1.0 200 OK
  Content-Type: text/xml; charset=utf-8
  Connection: close
  
  &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Body&gt;
      &lt;conc:GetProductsListResponse xmlns:conc="http://tempuri.org/XMLSchema.xsd"&gt;
        &lt;conc:Result&gt;
          &lt;conc:Products&gt;
             &lt;conc:Product conc:ProductID="4C475A0126111982" conc:GroupID="Default" /&gt;
          &lt;/conc:Products&gt;
        &lt;/conc:Result&gt;
      &lt;/conc:GetProductsListResponse&gt;
    &lt;/soap:Body&gt;
   &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Here is the definition from the .xsd and .wsdl files which works with this:</p>
  
  <pre><code>  &lt;xs:element name="GetProductsListResponse"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element name="Result"&gt;
            &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                &lt;xs:element name="Products" type="ProductsType" /&gt;
              &lt;/xs:sequence&gt;
            &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  
    &lt;xs:complexType name="ProductsType"&gt;
      &lt;xs:choice&gt;
        &lt;xs:element name="Product" maxOccurs="unbounded"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:attribute name="ProductID" type="xs:string"/&gt;
            &lt;xs:attribute name="GroupID" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
        &lt;xs:element name="Error"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:attribute name="ErrorID" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:choice&gt;
    &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I used Add Web Reference to add the reference. I used .NET 2.0 styled web services.</p>
  
  <p>Here are the generated proxy classes:</p>
  
  <pre><code>/// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://tempuri.org/XMLSchema.xsd")]
  public partial class GetProductsListResponse {
  
      private GetProductsListResponseResult resultField;
  
      /// &lt;remarks/&gt;
      public GetProductsListResponseResult Result {
          get {
              return this.resultField;
          }
          set {
              this.resultField = value;
          }
      }
  }
  
  /// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://tempuri.org/XMLSchema.xsd")]
  public partial class GetProductsListResponseResult {
  
      private ProductsType productsField;
  
      /// &lt;remarks/&gt;
      public ProductsType Products {
          get {
              return this.productsField;
          }
          set {
              this.productsField = value;
          }
      }
  }
  
  /// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/XMLSchema.xsd")]
  public partial class ProductsType {
  
      private ProductsTypeProduct[] itemsField;
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute("Product")]
      public ProductsTypeProduct[] Items {
          get {
              return this.itemsField;
          }
          set {
              this.itemsField = value;
          }
      }
  }
  
  /// &lt;remarks/&gt;
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://tempuri.org/XMLSchema.xsd")]
  public partial class ProductsTypeProduct {
  
      private string productIDField;
  
      private string groupIDField;
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlAttributeAttribute()]
      public string ProductID {
          get {
              return this.productIDField;
          }
          set {
              this.productIDField = value;
          }
      }
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlAttributeAttribute()]
      public string GroupID {
          get {
              return this.groupIDField;
          }
          set {
              this.groupIDField = value;
          }
      }
  }
  </code></pre>
  
  <p>The problem is, when the web service gets deserialized, ProductID and GroupID don't get deserialized (they are left to null) for some reason.</p>