none
wcf contract added properties got null values on the existing contract RRS feed

  • Question

  • namespace CQGlobal.BackOffice.Domain.RmsRepository
    {
        using System;
        using CQGlobal.BackOffice.Domain.RmsModel;
        using CQGlobal.BackOffice.Service.Types;
        using System.Collections.Generic;
        using TmsModel = CQGlobal.BackOffice.Domain.TmsModel;
        using tmsTypes = CQGlobal.BackOffice.Domain.TmsTypes;

        public interface IRiskManagementRepository : IDisposable
        {
            void DataAffectedByPriceChange(List<Tb_ClosingPrice> prices);

            //void DataAffectedByPositionChangeByOrder(List<Tb_OrderImport> orders);

            //IEnumerable<string> DataAffectedByPositionChangeByOrder(List<Tb_OrderImport> orders, ref List<RMSSummary> summary);

            IEnumerable<string> ExecuteNewOrders(List<Tb_OrderImport> orders, bool simulate = false);

            IEnumerable<string> FetchRMSTopics(string search);

            IEnumerable<string> FetchRMSTopics(string search, string orderby="AcctNo", int page=0, int size=0);

            IEnumerable<RMSDisplay> FetchRMSSummary(string search);

            IEnumerable<RMSDisplay> FetchRMSSummary(string search, string orderby = "AcctNo", int page = 0, int size = 0);

            IEnumerable<RMSDisplay> FetchRMSSummaryByTopic(List<string> topics, long companyId);

            IEnumerable<string> InsertRiskManagementSummaryRemarks(Tb_RiskManagementSummaryRemarks remark);

            IEnumerable<string> UpdateRiskManagementSummaryRemarks(Tb_RiskManagementSummaryRemarks remark);

            IEnumerable<string> DeleteRiskManagementSummaryRemarks(Tb_RiskManagementSummaryRemarks remark);

            IEnumerable<string> DeleteRiskManagementSummaryRemarks(Guid recordId);

            IEnumerable<Tb_RiskManagementSummaryRemarks> FetchSummaryRemarks(string acctNo, long companyId, int period = 0);

            #region "RMS details"

            IEnumerable<Tb_CashRPValuationCollateral> FetchValuationCollateral(long companyId, string acctNo = null, string currCd = null, long fundSourceID = 0);

            IEnumerable<Tb_CustodyAssetsRPValuationCollateral> FetchValuationCollateral(long companyId, string acctNo = null, string currCd = null, long fundSourceID = 0, long instrumentId = 0, long productId = 0);

            IEnumerable<Tb_NonEquityAssetsValuationCollateral> FetchValuationCollateral(long companyId, string acctNo = null, string assetNo = null);

            IEnumerable<TmsModel.Tb_Transactions> FetchTMSTransactions(long companyId, string acctNo = null, string transNo = null, string transGroupNo = null, string currCd = null, long fundSourceID = 0);

            IEnumerable<Tb_ContractOutstanding> FetchOutstandingContracts(long companyId, string acctNo = null, string contractNo = null, short contractPartNo = -1, string currCd = null, long fundSourceID = 0);

            IEnumerable<TmsModel.Tb_ContractOutstanding> FetchTMSOutstandingContracts(long companyId, string acctNo = null, string contractNo = null, short contractPartNo = -1, string currCd = null, long fundSourceID = 0);

            IEnumerable<Tb_OrderImport> FetchOrders(long companyId, string acctNo = null, long orderNo = 0, long subOrderNo = -1, string currCd = null);

            IEnumerable<TmsModel.Tb_ContractOutstanding> FetchExecutedOrdersAndTMSContracts(long companyId, string acctNo = null, string currCd = null);

            Tb_Date FetchBusinessDate(long companyId = 0);

            #endregion "RMS details"

        }
    }








    [LogOperation]
    [LogServiceErrors]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerCall)]
    public class RmsOrchestrationContext : EntityService<IRiskManagementRepository>,  CQGlobal.BackOffice.Service.Types.Contracts.IRmsContract
        {
            public string DoWork(string work)
            {
                //System.Diagnostics.Trace.WriteLine("Called From Service");
                return string.Format("You entered: {0}", work);
            }


     public IEnumerable<RMSDisplay> SearchSummary(string filter,string ordering="AccountNo",int pageNo=0, int pageSize=0)
            {
                try
                {
                    using (IRiskManagementRepository repo = new RiskManagementRepository())
                    {
                        return repo.FetchRMSSummary(filter, ordering, pageNo, pageSize);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                }

            }




    namespace CQGlobal.BackOffice.Service.Types
    {
        using System;
        using System.Runtime.Serialization;
        using System.Text;
        using System.Collections.Generic;

        [DataContract(IsReference = true, Namespace = "http://www.cqglobal.com/rms/")]
        [Serializable]
        public class RMSDisplay
        {
            [DataMember]
            public System.DateTime ReportDate { get; set; }

            [DataMember]
            public string RecordType { get; set; }

            [DataMember]
            public string AggregateLevel { get; set; }

            [DataMember]
            public string AcctNo { get; set; }

            [DataMember]
            public long CompanyId { get; set; }

            [DataMember]
            public string CurrCd { get; set; }

            [DataMember]
            public int SchemeId { get; set; }

            [DataMember]
            public decimal ExchRate { get; set; }

            [DataMember]
            public decimal LedgerBFBalance { get; set; }

            [DataMember]
            public decimal EquitySettlement { get; set; }

            [DataMember]
            public decimal Adjustment { get; set; }

            [DataMember]
            public decimal RealisedPL { get; set; }

            [DataMember]
            public decimal CommissionCharges { get; set; }

            [DataMember]
            public decimal OptionPremium { get; set; }

            [DataMember]
            public decimal LedgerRPBalance { get; set; }

            [DataMember]
            public decimal CollateralRPBalance { get; set; }

            [DataMember]
            public decimal UnrealisedPLBalance { get; set; }

            [DataMember]
            public decimal MarginIM { get; set; }

            [DataMember]
            public decimal MarginMM { get; set; }

            [DataMember]
            public decimal MarginIMExcessDeficit { get; set; }

            [DataMember]
            public decimal MarginIMRPExcessDeficit { get; set; }

            [DataMember]
            public decimal MarginMMExcessDeficit { get; set; }

            [DataMember]
            public decimal MarginMMRPExcessDeficit { get; set; }

            [DataMember]
            public System.DateTime LastUpdated { get; set; }

            [DataMember]
            public string AcctExecutiveCd { get; set; }

            [DataMember]
            public Nullable<System.Guid> RecordId { get; set; }

            [DataMember]
            public string Topic { get; set; }

            [DataMember]
            public string Remarks { get; set; }

            [DataMember]
            public int Page { get; set; }

            [DataMember]
            public int Size { get; set; }

            [DataMember]
            public int TotalCount { get; set; }

            [DataMember]
            public List<string> ValidationErrors { get; set; }

            *[DataMember]
            public string ClientName { get; set; }*



            #region IExtensibleDataObject Members

            public ExtensionDataObject ExtensionData { get; set; }

            #endregion IExtensibleDataObject Members
        }
    }



    I wrote my service in visual studio 2010 version. And then I upgraded it into visual studio 2012. When I add properties to my contract the ClientName I got a null value to this property. I already tried put order in the fields still I don't get the value I expected even I hardcoded the value. I also try recycle of the AppPool, restart my pc still has error. Sorry I dont show you the actual implementation of this function repo.FetchRMSSummary(filter, ordering, pageNo, pageSize). As I traced it in the server side it has a value but when i consume the service I cannot get right value. My property become a nullobject but the rest old properties has the right value.

    Please help me.
    Saturday, April 27, 2013 3:37 AM

All replies

  • Hi, do you mean this issue just occurs on the project after upgrade to VS 2012?

    For the information you provided, it is hard to find the issue.

    Monday, April 29, 2013 10:13 AM
  • Hello,

    I was suspicious that you might not have decorated your property "ClientName" with data member attribute which would have been stopping it from getting across to your presentation layer but it is there.The other suspicion I have , since I can't see the code is , the following

    1.May be somewhere in your code , you might be re-assigning the ClientName or the whole class object that contains it.

    2. You might be assigning the returned object from FetchRMSSummary method to some inherited object which might not have that property probably ( I am not sure about this ).

    Thanks,

    BR,

    JollyWagoner

    Monday, April 29, 2013 3:34 PM
  • Yeah, It was working on version 2010 and in the middle of the development we upgrade to 2012 with .net framework 4.5. Now I have troubled getting out with the issue. When I add Operation contract 

    The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'SearchSummary2'. End element 'Body' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'SearchSummary2' from namespace 'http://www.cqglobal.com/orchestrationengine'. Line 1, position 687. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
    System.ServiceModel.Dispatcher.NetDispatcherFaultException: The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'SearchSummary2'. End element 'Body' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'SearchSummary2' from namespace 'http://www.cqglobal.com/orchestrationengine'. Line 1, position 687. ----> System.Xml.XmlException: End element 'Body' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'SearchSummary2' from namespace 'http://www.cqglobal.com/orchestrationengine'. Line 1, position 687.
       at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
       at System.Xml.XmlBaseReader.ReadEndElement()
       at System.ServiceModel.Channels.Message.ReadFromBodyContentsToEnd(XmlDictionaryReader reader, Enve...).}


    • Edited by klienster Tuesday, April 30, 2013 6:27 AM
    Tuesday, April 30, 2013 6:26 AM
  • No. I decorated it with DateMember and in server the values are fine but the client cannot gable up the real object
    Tuesday, April 30, 2013 6:28 AM
  • Have you found the solution yet ?
    Monday, May 6, 2013 6:33 PM