none
XML Serialization of a class derived from DataSet and returned by an XML WebMethod RRS feed

  • Question

  • Colleges,
    Environment: OS: Windows 7, IIS 7.5, VS2008SP1, Web Service uses either .NET 2.0 or .NET 3.5 which doesn't change the outcome.

    When a WCF client proxy is generated by VS2008 (this is default, I didn't check the checkmark "XML Web Service" on the Service Reference dialog) for an XML WebService containing method below,

    [

    WebMethod]public MedicationInventoryData GetAllMedicationInventoryData2b(string sFilter, bool bIncludeImages) { ...}

    the method on the client side in Reference.cs looks

    [System.ServiceModel.

    OperationContractAttribute(Action="http://tempuri.org/GetAllMedicationInventoryData2b", ReplyAction="*")]

    [System.ServiceModel.

    XmlSerializerFormatAttribute()]

    PCAS.M2.Server.CentralWSProxy.CentralWebServices.

    NewDataSet GetAllMedicationInventoryData2b(string sFilter, bool bIncludeImages);

    basically, the MedicationInventoryDataSet was not created.
    The code for the derived dataset is below.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    using


    using

     

    System;

    using

     

    System.Data;

    using

     

    System.Runtime.Serialization;

    using

     

    System.Collections;

    namespace

     

    PCAS.M2.Common.Data

    {

     

    /// <summary>

     

    /// A custom serializable dataset containing data information

     

    /// </summary>

     

    ///

    [System.ComponentModel.

    DesignerCategory("Code")]

    [

    SerializableAttribute]

     

    public class MedicationData : DataSet

    {

     

    //

     

    //Constants

     

    //

     

    public const string TABLE = "Medication";

     

    public const string MEDICATIONID_FIELD = "MedicationId";

     

    public const string DRUGCODE_FIELD = "DrugCode";

     

    public const string DRUGCODETYPE_FIELD = "DrugCodeType";

     

    public const string NAME_FIELD = "Name";

     

    public const string COMPANYID_FIELD = "CompanyId";

     

    public const string COMPANYNAME_FIELD = "CompanyName";

     

    public const string DOSAGE_FIELD = "Dosage";

     

    public const string UNITID_FIELD = "UnitId";

     

    public const string UNITCOST_FIELD = "UnitCost";

     

    public const string ISGENERIC_FIELD = "IsGeneric";

     

    public const string LONGNAME_FIELD = "LongName";

     

    public const string CLINICALFORMULATIONID_FIELD = "ClinicalFormulationID";

     

    public const string CLINICALFORMULATIONNAME_FIELD = "ClinicalFormulationName";

     

    public const string REGULATORYCODE_FIELD = "RegulatoryCode";

     

    public const string REFERENCEIMAGE_FIELD = "ReferenceImage";

     

    public const string MEDICATION_ENVIRONMENTID_FIELD = "MedicationEnvironmentID";

     

    public const string THERAPEUTICCLASSID_FIELD = "TherapeuticClassID";

     

     

     

    /// <summary>

     

    /// Constructor to support serialization.

     

    /// <remarks>Constructor that supports serialization.</remarks>

     

    /// <param name="info">The SerializationInfo object to read from.</param>

     

    /// <param name="context">Information on who is calling this method.</param>

     

    /// </summary>

     

    public MedicationData(SerializationInfo info, StreamingContext context) : base(info, context)

    {

    }

     

     

    /// <summary>

     

    /// Constructor.

     

    /// </summary>

     

    public MedicationData()

    {

     

    //

     

    <span style="color: #008000; font-size: x-s

    Monday, February 1, 2010 1:26 AM

All replies