title: Basic WCF question
body: <p>I usually can create an instance of a class called <code>SalesItem</code> and pass that as a parameter to a web service like so <code>webService.CreateSalesitem(New SalesItem())</code> This works fine.</p>
  
  <p>I then subclassed my <code>SalesItem</code> class. I called it <code>GP_Item_SIM_Product</code>. However when I try to pass this class as a paramter to my web service, I get an exception. <code>webService.CreateSalesitem(new GP_Item_SIM_Product()</code>) </p>
  
  <p>Here is the exception:</p>
  
  <blockquote>
    <p>There was an error while trying to serialize parameter
    <a href="http://schemas.microsoft.com/dynamics/gp/2010/01:salesItem" rel="nofollow">http://schemas.microsoft.com/dynamics/gp/2010/01:salesItem</a>. The
    InnerException message was 'Type 'IMS.GP_Item_SIM_Product' with data
    contract name
    'GP_Item_SIM_Product:http://schemas.datacontract.org/2004/07/IMS' is
    not expected. Consider using a DataContractResolver or add any types
    not known statically to the list of known types - for example, by
    using the KnownTypeAttribute attribute or by adding them to the list
    of known types passed to DataContractSerializer.'.  Please see
    InnerException for more details.</p>
  </blockquote>
  
  <p>Here is my subclass:</p>
  
  <pre><code>Imports System.ServiceModel
  Imports GP_1.DynamicsGPClient
  Imports GP_1.Microsoft.Dynamics.GP
  Imports GP_1.Microsoft.Dynamics.Common
  Imports SierraLib
  Imports GP_1.GP
  Imports GP_1
  Imports System.Runtime.Serialization
  
  &lt; DataContract() &gt; _
  Public Class GP_Item_SIM_Product
      Inherits SalesItem
  
      Dim SIMProduct As Products
      Dim greatPlainsRunner As GPRunner
  
      Public Sub New(ByVal gpr As GPRunner, ByVal product As Products)
          SIMProduct = product
          greatPlainsRunner = gpr
          SetValues()
      End Sub
  
      Private Sub SetValues()
          Me.Key = New ItemKey() With {.Id = SIMProduct.MFGPN}
          Me.Description = Description
          Me.CurrentCost = New MoneyAmount() With {.Currency = Defaults.usCurrency, .Value = CDec(SIMProduct.Cost)}
          Me.StandardCost = New MoneyAmount() With {.Currency = Defaults.usCurrency, .Value = CDec(SIMProduct.Price)}
          Me.IsDiscontinued = Not SIMProduct.Enabled
          Me.SalesTaxBasis = IIf(CBool(SIMProduct.Taxed = True),
                              GP_1.Microsoft.Dynamics.GP.SalesTaxBasis.Taxable,
                              GP_1.Microsoft.Dynamics.GP.SalesTaxBasis.Nontaxable)
      End Sub
  
  
  End Class
  </code></pre>
  
  <p>Any ideas how I can modify my class so that it can be sent to the web service. I think it has something to do with the two fields in this class that I added. Not sure if I need to mark them as anything special.</p>