locked
consume webservice wsdl RRS feed

  • Question

  • User-506497988 posted

    Hi All ,

    Am new in webservice I have to create web form to consume wsdl web service  below sample request from xml file of wsdl request

    ------

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://integration.esi.dtps.gov.ae/">
    <soapenv:Header>
          <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
             <wsse:UsernameToken wsu:Id="UsernameToken-4" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:Username>emitac</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">emitac123</wsse:Password>
             </wsse:UsernameToken>
          </wsse:Security>
       </soapenv:Header>
       <soapenv:Body>
          <int:submitMapDetails>
             <!--Optional:-->
             <arg0>
                <attachementList>
                   <serial>5077203</serial>
                </attachementList>
                <attachementList>
                   <serial>5077204</serial>
                </attachementList>  
        <amount>400.0</amount>
                <angelsApptypeId>1</angelsApptypeId>
                <angelsLandUsageId>4</angelsLandUsageId>
                <angelsTrxType>201</angelsTrxType>
                <applicantDesignationId>4</applicantDesignationId>
                <applicantName>سامر أسامة الشامي</applicantName>
                <apptypeId>2</apptypeId>
                <buildingLicenseQuestion>1</buildingLicenseQuestion>
                <civilApptypeId>21</civilApptypeId>
                <civilLandUsageId>10</civilLandUsageId>
                <civilTrxType>207</civilTrxType>
                <empostDetails/>
                <firstIssueDate>20-11-2005</firstIssueDate>
                <interlockApptypeId>1</interlockApptypeId>
                <interlockLandUsageId>4</interlockLandUsageId>
                <interlockTrxType>401</interlockTrxType>
                <issuanceRenewalBldgLicenseDt>09-09-2018</issuanceRenewalBldgLicenseDt>
                <landSituationFlag>5</landSituationFlag>
                <landUsageAr>سكني</landUsageAr>
                <landUsageEn>Residential</landUsageEn>
                <landUsageId>4</landUsageId>
                <lastRenewalMapDate>06-08-2018</lastRenewalMapDate>
                <mobileNo>0561265222</mobileNo>
                <ownerList>
                   <familyNo>16572</familyNo>
                   <maritalStatus>M</maritalStatus>
                   <mobileNo>0505236477</mobileNo>
                   <noOfChildrens>3</noOfChildrens>
                   <ownerId>784197648163711</ownerId>
                   <ownerName>عاصم عبدالجابر</ownerName>
                   <ownerType>1</ownerType>
                   <townNo>301</townNo>
                </ownerList>
                <plannApptypeId>1</plannApptypeId>
                <plannLandUsageId>10</plannLandUsageId>
                <plannTrxType>102</plannTrxType>
                <plotsList>
                   <areaCode>3183</areaCode>
                   <areaNameAr>السيوح 3</areaNameAr>
                   <areaNameEn>AL SEYOUH 3</areaNameEn>
                   <cityCode>301</cityCode>
                   <cityNameAr>مدينة الشارقة</cityNameAr>
                   <cityNameEn>SHARJAH CITY</cityNameEn>
                   <govNum>1110</govNum>
                   <govNumEntered>0</govNumEntered>
                   <plotArea>2247.7</plotArea>
                   <suburbCode>1025</suburbCode>
                   <withPlanningCondition>0</withPlanningCondition>
                </plotsList>
                <soilApptypeId>1</soilApptypeId>
                <soilLandUsageId>10</soilLandUsageId>
                <soilTrxType>207</soilTrxType>
                <statusId>5</statusId>
                <trxNo>2042019000575511</trxNo>
                <trxTypeId>204</trxTypeId>
                <userName>khaledds</userName>
                <statusId>1</statusId>
             </arg0>
          </int:submitMapDetails>
       </soapenv:Body>
    </soapenv:Envelope>
    -----
    below my c# code in web form sample below i need to send the values for the request :
    public void RequestData()
        {
          //  try
           // {
               // System.Text.StringBuilder vgovnum = new System.Text.StringBuilder();
                ServiceReference1.ShjrerdIntegrationServicePortTypeClient client = new ServiceReference1.ShjrerdIntegrationServicePortTypeClient();
                client.Endpoint.Behaviors.Add(new CustomEndpointBehavior());
            //client.
            ServiceReference1.mapVO xx = new ServiceReference1.mapVO();
           
         //  ServiceReference1.submitMapDetailsRequest mo3 = new ServiceReference1.submitMapDetailsRequest(xx);
               xx.applicantName = "Asem Abeljaber Test Main";
               xx.mobileNo = "971501717128";
     
            //owner list
     
            ServiceReference1.ownersVO ovo = new ServiceReference1.ownersVO();
            ServiceReference1.transactionPlotDetailsVO po = new ServiceReference1.transactionPlotDetailsVO();
     
            ServiceReference1.ownersVO ov = new ServiceReference1.ownersVO();
     
           
    xx.ownerList[0].familyNo = 32432;
     
            xx.ownerList[0].maritalStatus = "M";
            xx.ownerList[0].mobileNo = "971501717128";
            xx.ownerList[0].noOfChildrens = 0;
            xx.ownerList[0].ownerId = "784198015147649";
            xx.ownerList[0].ownerName = "Asem Abdeljaber Test";
            xx.ownerList[0].ownerType = 1;
            xx.ownerList[0].townNo = 301
            //owner list end
            //plot list
            //mo3.plotsList[0].areaCode = 3018;
            po.areaCode = 3018;
            po.areaNameAr = "";
            po.cityCode = 301;
            po.cityNameAr = "الشارقة";
            po.govNum = "856";
            po.govNumEntered = 0;
            po.plotArea = 1155;
            po.suburbCode = 1133;
            po.withPlanningCondition = 0;
            //plot list end
            xx.userName = "SHJRERD";
                xx.statusId = 1;
                
                string xxx = client.submitMapDetails(xx);
                Response.Write("TRN NO :"+xxx.ToString());
     
             
           // }
           /* catch (Exception ex)
            {
     
                Response.Write("<center><b><h1 style=color:#FF0000>لا يوجد بيانات لهذا السند يرجى مراجعة قسم الانظمة</h1></b></center></br></br></br>");
                Response.Write(ex.ToString());
                //  Response.Write("<script language=javascript>this.window.opener = null;window.open('','_self'); window.close();   </script>");
                //MsgBox("لا يوجد بيانات لهذا السند يرجى مراجعة قسم الانظمة");
                Response.End();
            }*/
     
        }
    ------
    am getinf this error 
    System.NullReferenceException: 'Object reference not set to an instance of an object.'
     
    ServiceReference1.mapVO.ownerList.get returned null.
    please help i think there is somthing wrong of how to set the values
    thanks
    Friday, January 8, 2021 8:27 PM

All replies

  • User-1545767719 posted

    Are you saying that you have a proper wsdl file and want to produce a service proxy?

    If so, try to use the wsdl.exe or Visual Studio.

    Friday, January 8, 2021 9:48 PM
  • User-506497988 posted

    Thank you for reply the case that i need to send request which contains 10 variables and one of them have list of array after submit i will get like refno to follow the status of request latter i dont know if i explain to you clearly if not i can send the files to you check

    Thanks

    Saturday, January 9, 2021 5:52 AM
  • User-1545767719 posted

    Can you answer to my question above? I repeat it below:

    Are you saying that you have a proper wsdl file and want to produce a service proxy?

    Otherwise I can’t help as I do not know what you want to do.

    Saturday, January 9, 2021 6:12 AM
  • User-943250815 posted

    hilal_w, next time place your code using "Insert/edit code sample" it is in "{;}" icon.
    Your exception say ServiceReference1.mapVO.ownerList.get returned null.
    You should check what type is expected in "ownerList" and add data properly

    Saturday, January 9, 2021 12:15 PM
  • User-506497988 posted

    sorry for that and thanks for the advise see below service reference methods

    I need to use submitMapDetails(mapVO arg0) to create the request which has mapvo added below the servicereference

    my issue as you said in mapvo.ownerlist i need to set value not to get 

    i hope i explain well sorry again 

    using System.CodeDom.Compiler;
    using System.Diagnostics;
    using System.ServiceModel;
    using System.ServiceModel.Channels;
    
    namespace ServiceReference1
    {
        [DebuggerStepThrough]
        [GeneratedCode("System.ServiceModel", "4.0.0.0")]
        public class ShjrerdIntegrationServicePortTypeClient : ClientBase<ShjrerdIntegrationServicePortType>, ShjrerdIntegrationServicePortType
        {
            public ShjrerdIntegrationServicePortTypeClient();
            public ShjrerdIntegrationServicePortTypeClient(string endpointConfigurationName);
            public ShjrerdIntegrationServicePortTypeClient(string endpointConfigurationName, string remoteAddress);
            public ShjrerdIntegrationServicePortTypeClient(string endpointConfigurationName, EndpointAddress remoteAddress);
            public ShjrerdIntegrationServicePortTypeClient(Binding binding, EndpointAddress remoteAddress);
    
            public transactionVO[] getAllRealestateFinalProductForComplianceReport(string trxNo);
            public landUsageVO[] getLandUsageById(int arg0);
            public landUsageVO[] getLandUsageList(string arg0);
            public mapVO getSplitBuildingDetails(string ownershipCertNo, string ownershipCertDate);
            public transactionPlotDetailsVO[] getSplitPlotbyTrxNo(string trxNo);
            public transactionPlotDetailsVO[] getSplitPlotDetails(string ownershipCertNo, string ownershipCertDate);
            public transactionVO getTransactionDetail(string trxNo);
            public trxTypeVO[] getTrxTypeList();
            public string submitMapDetails(mapVO arg0);
        }
    }
     public class mapVO : INotifyPropertyChanged
        {
            public mapVO();
    
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 27)]
            public string issuanceRenewalBldgLicenseDt { get; set; }
            [XmlIgnore]
            public bool plannApptypeIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 42)]
            public int plannApptypeId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 41)]
            public string ownershipCertNo { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 40)]
            public string ownershipCertDate { get; set; }
            [XmlElement("ownerList", Form = XmlSchemaForm.Unqualified, IsNullable = true, Order = 39)]
            public ownersVO[] ownerList { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 38)]
            public string orderVoucherNo { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 37)]
            public string oldTrxNo { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 36)]
            public string mobileNo { get; set; }
            [XmlIgnore]
            public bool mapAmountSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 35)]
            public double mapAmount { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 34)]
            public string lastRenewalMapDate { get; set; }
            [XmlIgnore]
            public bool landUsageIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 33)]
            public int landUsageId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 32)]
            public string landUsageEn { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 31)]
            public string landUsageAr { get; set; }
            [XmlIgnore]
            public bool landSituationFlagSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 30)]
            public int landSituationFlag { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 29)]
            public string landSituationEn { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 43)]
            public int plannLandUsageId { get; set; }
            [XmlIgnore]
            public bool plannLandUsageIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 44)]
            public int plannTrxType { get; set; }
            [XmlIgnore]
            public bool plannTrxTypeSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 57)]
            public int trxTypeId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 56)]
            public string trxNo { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 55)]
            public string submissionDate { get; set; }
            [XmlIgnore]
            public bool statusIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 54)]
            public int statusId { get; set; }
            [XmlIgnore]
            public bool soilTrxTypeSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 53)]
            public int soilTrxType { get; set; }
            [XmlIgnore]
            public bool soilLandUsageIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 28)]
            public string landSituationAr { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 52)]
            public int soilLandUsageId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 51)]
            public int soilApptypeId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 50)]
            public string rejectedTrxNo { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 49)]
            public string rejectedRemarks { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 48)]
            public string receiptNo { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 47)]
            public string receiptDate { get; set; }
            [XmlElement("plotsList", Form = XmlSchemaForm.Unqualified, IsNullable = true, Order = 46)]
            public transactionPlotDetailsVO[] plotsList { get; set; }
            [XmlIgnore]
            public bool planningCondAmountSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 45)]
            public double planningCondAmount { get; set; }
            [XmlIgnore]
            public bool soilApptypeIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 59)]
            public string userName { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 26)]
            public string issuanceRenewalBldgGrantDt { get; set; }
            [XmlIgnore]
            public bool interlockTrxTypeSpecified { get; set; }
            [XmlIgnore]
            public bool buildingGrantedQuestionSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 10)]
            public int buildingGrantedQuestion { get; set; }
            [XmlElement("attachementList", Form = XmlSchemaForm.Unqualified, IsNullable = true, Order = 9)]
            public attachmentVO[] attachementList { get; set; }
            [XmlIgnore]
            public bool apptypeIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 8)]
            public int apptypeId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 7)]
            public applicantVO applicantVO { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 6)]
            public string applicantName { get; set; }
            [XmlIgnore]
            public bool applicantDesignationIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 11)]
            public int buildingLicenseQuestion { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 5)]
            public int applicantDesignationId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 4)]
            public int angelsTrxType { get; set; }
            [XmlIgnore]
            public bool angelsLandUsageIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 3)]
            public int angelsLandUsageId { get; set; }
            [XmlIgnore]
            public bool angelsApptypeIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 2)]
            public int angelsApptypeId { get; set; }
            [XmlIgnore]
            public bool amountSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 1)]
            public double amount { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 0)]
            public string actualParking { get; set; }
            [XmlIgnore]
            public bool angelsTrxTypeSpecified { get; set; }
            [XmlIgnore]
            public bool trxTypeIdSpecified { get; set; }
            [XmlIgnore]
            public bool buildingLicenseQuestionSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 13)]
            public int civilApptypeId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 25)]
            public int interlockTrxType { get; set; }
            [XmlIgnore]
            public bool interlockLandUsageIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 24)]
            public int interlockLandUsageId { get; set; }
            [XmlIgnore]
            public bool interlockApptypeIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 23)]
            public int interlockApptypeId { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 22)]
            public string firstIssueDate { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 21)]
            public finalProductVO finalProduct { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 20)]
            public string expiryDate { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 12)]
            public string buildingName { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 19)]
            public empostVO empostDetails { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 18)]
            public int empostDelivery { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 17)]
            public string email { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 16)]
            public string completionCertNo { get; set; }
            [XmlIgnore]
            public bool civilTrxTypeSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 15)]
            public int civilTrxType { get; set; }
            [XmlIgnore]
            public bool civilLandUsageIdSpecified { get; set; }
            [XmlElement(Form = XmlSchemaForm.Unqualified, Order = 14)]
            public int civilLandUsageId { get; set; }
            [XmlIgnore]
            public bool civilApptypeIdSpecified { get; set; }
            [XmlIgnore]
            public bool empostDeliverySpecified { get; set; }
            [XmlElement("unitList", Form = XmlSchemaForm.Unqualified, IsNullable = true, Order = 58)]
            public unitVO[] unitList { get; set; }
    
            public event PropertyChangedEventHandler PropertyChanged;
    
            protected void RaisePropertyChanged(string propertyName);
        }

    Saturday, January 9, 2021 1:40 PM
  • User-506497988 posted

    yes i have wsdl file or link and i need to produce service

    Saturday, January 9, 2021 1:58 PM
  • User475983607 posted

    i recommend going through a beginning level tutorial  Creating a service reference from the WSDL is very simple and handled by the service reference wizard.  Calling the web service is requires that you understand how the service works. 

    ASMX

    https://docs.microsoft.com/en-us/troubleshoot/dotnet/csharp/write-web-service

    WCF

    https://docs.microsoft.com/en-us/dotnet/framework/wcf/getting-started-tutorial

    Being new to services, you should consider Web API over SOAP (ASMX and WCF).  

    ASP.NET

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api

    .net5.0 (newest framework)

    https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio

    Saturday, January 9, 2021 2:30 PM
  • User-1545767719 posted

    In your reply above, it seems to me that you already have the sevice proxy generated from the wsdl file. Then what is your problem? Are you saying that you cannot use the service proxy?

    Saturday, January 9, 2021 11:43 PM
  • User-506497988 posted

    Find below my code after implementing the service and the error Message:

    error in line :  xx.ownerList[0].familyNo = 32432;

    error descreption:

    System.NullReferenceException: 'Object reference not set to an instance of an object.'

    ServiceReference1.mapVO.ownerList.get returned null.

    public void SendRequestData()
        {
          
            ServiceReference1.ShjrerdIntegrationServicePortTypeClient client = new ServiceReference1.ShjrerdIntegrationServicePortTypeClient();
            client.Endpoint.Behaviors.Add(new CustomEndpointBehavior());
            ServiceReference1.mapVO mapVO = new ServiceReference1.mapVO();
            ServiceReference1.mapVO xx = mapVO;      
            xx.applicantName = "Asem Abeljaber Test Main";
            xx.mobileNo = "971501717128";
            xx.userName = "SHJRERD";
            xx.statusId = 1;
            //owner list  array               
            xx.ownerList[0].familyNo = 32432;
            xx.ownerList[0].maritalStatus = "M";
            xx.ownerList[0].mobileNo = "971501717128";
            xx.ownerList[0].noOfChildrens = 0;
            xx.ownerList[0].ownerId = "784198015147649";
            xx.ownerList[0].ownerName = "Asem Abdeljaber Test";
            xx.ownerList[0].ownerType = 1;
            xx.ownerList[0].townNo = 301;
            //owner list end
           string xxx = client.submitMapDetails(xx);
           Response.Write("TRN NO :"+xxx.ToString());
         
        }

    Sunday, January 10, 2021 6:12 AM
  • User475983607 posted

    This C# programming issue.  The code tries to assign a value to an array element (ownerList) when the array has not been created.   You'll need to define a "new" ownerList.  We cannot see the type so you'll need to do that bit.

    Sunday, January 10, 2021 12:49 PM
  • User-506497988 posted

    If i share it you can show me how please? 

    Sunday, January 10, 2021 1:02 PM
  • User475983607 posted

    hilal_w

    If i share it you can show me how please?

    The problem you are having has to do with basic C# types.  I recommend reading the C# programming guide to learn how to instantiate an array.

    https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/

    Keep in mind you must also instantiate each complex type that makes up an array item.

    Sunday, January 10, 2021 1:09 PM
  • User-506497988 posted

    Thanks alot i will give try let you know the result

    Sunday, January 10, 2021 3:19 PM
  • User-506497988 posted

    hi again i created array of var but still i have error how to assign my array to the object of the service check the code i hope will get understand from bcoz i am not good of this 

    //how to assign my array to xx.ownerlist this my issue {get;set;}

    sorry again 

    regards

    ServiceReference1.ShjrerdIntegrationServicePortTypeClient client = new ServiceReference1.ShjrerdIntegrationServicePortTypeClient();
            client.Endpoint.Behaviors.Add(new CustomEndpointBehavior());       
            ServiceReference1.mapVO mapVO = new ServiceReference1.mapVO();
            ServiceReference1.mapVO xx = mapVO;
    
    xx.applicantName = "Asem Abeljaber Test Main"; xx.mobileNo = "971501717128"; xx.userName = "SHJRERD"; xx.statusId = 1; //owner list var ownersinfo = new[] { new { familyno = 1254, maritalStatus = "M", mobileNo ="971501717128", noOfChildrens = 0, ownerId = "784198015147649", ownerName = "Asem Abdeljaber Test", ownerType = 1, townNo = 301 } };

    //how to assign my array to xx.ownerlist this my issue {get;set;}
    Sunday, January 10, 2021 8:29 PM
  • User475983607 posted

    You have to new the actual type which you defined; ownersVO[].  You really need to take the time to learn C# array and type syntax fundamentals.  Don't use var until you understand C# type it will just get you into trouble.

     ownersVO[] ownersinfo = new ownersVO[]      
     {
        new  ownersVO() 
        {
            familyno = 1254,
            maritalStatus = "M",
            mobileNo ="971501717128",
            noOfChildrens = 0,
            ownerId = "784198015147649",
            ownerName = "Asem Abdeljaber Test",
            ownerType = 1,
            townNo = 301
        },

    Sunday, January 10, 2021 9:32 PM
  • User-506497988 posted

    thanks a lot for your response it was very helpful for me last thing i need to fill the values of this array from database query how to add 

    foreach (System.Data.DataRow dr in ds.Tables[0].Rows) to the above array of objects 

    thanks

    Wednesday, January 13, 2021 8:15 PM