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
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
sorry for that and thanks for the advise see below service reference methods
I need to usesubmitMapDetails(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);
}
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.
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?
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.
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;}
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.
None
0 Points
13 Posts
consume webservice wsdl
Jan 08, 2021 08:27 PM|hilal_w|LINK
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
------
<div><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://integration.esi.dtps.gov.ae/"></div> <div><soapenv:Header></div> <div> <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"></div> <div> <wsse:UsernameToken wsu:Id="UsernameToken-4" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"></div> <div> <wsse:Username>emitac</wsse:Username></div> <div> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">emitac123</wsse:Password></div> <div> </wsse:UsernameToken></div> <div> </wsse:Security></div> <div> </soapenv:Header></div> <div> <soapenv:Body></div> <div> <int:submitMapDetails></div> <div> <!--Optional:--></div> <div> <arg0></div> <div> <attachementList></div> <div> <serial>5077203</serial></div> <div> </attachementList></div> <div> <attachementList></div> <div> <serial>5077204</serial></div> <div> </attachementList> </div> <div> <amount>400.0</amount></div> <div> <angelsApptypeId>1</angelsApptypeId></div> <div> <angelsLandUsageId>4</angelsLandUsageId></div> <div> <angelsTrxType>201</angelsTrxType></div> <div> <applicantDesignationId>4</applicantDesignationId></div> <div> <applicantName>سامر أسامة الشامي</applicantName></div> <div> <apptypeId>2</apptypeId></div> <div> <buildingLicenseQuestion>1</buildingLicenseQuestion></div> <div> <civilApptypeId>21</civilApptypeId></div> <div> <civilLandUsageId>10</civilLandUsageId></div> <div> <civilTrxType>207</civilTrxType></div> <div> <empostDetails/></div> <div> <firstIssueDate>20-11-2005</firstIssueDate></div> <div> <interlockApptypeId>1</interlockApptypeId></div> <div> <interlockLandUsageId>4</interlockLandUsageId></div> <div> <interlockTrxType>401</interlockTrxType></div> <div> <issuanceRenewalBldgLicenseDt>09-09-2018</issuanceRenewalBldgLicenseDt></div> <div> <landSituationFlag>5</landSituationFlag></div> <div> <landUsageAr>سكني</landUsageAr></div> <div> <landUsageEn>Residential</landUsageEn></div> <div> <landUsageId>4</landUsageId></div> <div> <lastRenewalMapDate>06-08-2018</lastRenewalMapDate></div> <div> <mobileNo>0561265222</mobileNo></div> <div> <ownerList></div> <div> <familyNo>16572</familyNo></div> <div> <maritalStatus>M</maritalStatus></div> <div> <mobileNo>0505236477</mobileNo></div> <div> <noOfChildrens>3</noOfChildrens></div> <div> <ownerId>784197648163711</ownerId></div> <div> <ownerName>عاصم عبدالجابر</ownerName></div> <div> <ownerType>1</ownerType></div> <div> <townNo>301</townNo></div> <div> </ownerList></div> <div> <plannApptypeId>1</plannApptypeId></div> <div> <plannLandUsageId>10</plannLandUsageId></div> <div> <plannTrxType>102</plannTrxType></div> <div> <plotsList></div> <div> <areaCode>3183</areaCode></div> <div> <areaNameAr>السيوح 3</areaNameAr></div> <div> <areaNameEn>AL SEYOUH 3</areaNameEn></div> <div> <cityCode>301</cityCode></div> <div> <cityNameAr>مدينة الشارقة</cityNameAr></div> <div> <cityNameEn>SHARJAH CITY</cityNameEn></div> <div> <govNum>1110</govNum></div> <div> <govNumEntered>0</govNumEntered></div> <div> <plotArea>2247.7</plotArea></div> <div> <suburbCode>1025</suburbCode></div> <div> <withPlanningCondition>0</withPlanningCondition></div> <div> </plotsList></div> <div> <soilApptypeId>1</soilApptypeId></div> <div> <soilLandUsageId>10</soilLandUsageId></div> <div> <soilTrxType>207</soilTrxType></div> <div> <statusId>5</statusId></div> <div> <trxNo>2042019000575511</trxNo></div> <div> <trxTypeId>204</trxTypeId></div> <div> <userName>khaledds</userName></div> <div> <statusId>1</statusId></div> <div> </arg0></div> <div> </int:submitMapDetails></div> <div> </soapenv:Body></div> <div></soapenv:Envelope></div> <div>-----</div> <div></div> <div>below my c# code in web form sample below i need to send the values for the request :</div> <div></div> <div> <div>public void RequestData()</div> <div> {</div> <div> // try</div> <div> // {</div> <div> // System.Text.StringBuilder vgovnum = new System.Text.StringBuilder();</div> <div> ServiceReference1.ShjrerdIntegrationServicePortTypeClient client = new ServiceReference1.ShjrerdIntegrationServicePortTypeClient();</div> <div> client.Endpoint.Behaviors.Add(new CustomEndpointBehavior());</div> <div> //client.</div> <div> ServiceReference1.mapVO xx = new ServiceReference1.mapVO();</div> <div> </div> <div> // ServiceReference1.submitMapDetailsRequest mo3 = new ServiceReference1.submitMapDetailsRequest(xx);</div> <div> xx.applicantName = "Asem Abeljaber Test Main";</div> <div> xx.mobileNo = "971501717128";</div> <div> </div> <div> //owner list</div> <div> </div> <div> ServiceReference1.ownersVO ovo = new ServiceReference1.ownersVO();</div> <div> ServiceReference1.transactionPlotDetailsVO po = new ServiceReference1.transactionPlotDetailsVO();</div> <div> </div> <div> ServiceReference1.ownersVO ov = new ServiceReference1.ownersVO();</div> <div> </div> <div> </div> <div>xx.ownerList[0].familyNo = 32432;</div> <div> </div> <div> xx.ownerList[0].maritalStatus = "M";</div> <div> xx.ownerList[0].mobileNo = "971501717128";</div> <div> xx.ownerList[0].noOfChildrens = 0;</div> <div> xx.ownerList[0].ownerId = "784198015147649";</div> <div> xx.ownerList[0].ownerName = "Asem Abdeljaber Test";</div> <div> xx.ownerList[0].ownerType = 1;</div> <div> xx.ownerList[0].townNo = 301</div> <div> //owner list end</div> <div> //plot list</div> <div> //mo3.plotsList[0].areaCode = 3018;</div> <div> po.areaCode = 3018;</div> <div> po.areaNameAr = "";</div> <div> po.cityCode = 301;</div> <div> po.cityNameAr = "الشارقة";</div> <div> po.govNum = "856";</div> <div> po.govNumEntered = 0;</div> <div> po.plotArea = 1155;</div> <div> po.suburbCode = 1133;</div> <div> po.withPlanningCondition = 0;</div> <div> //plot list end</div> <div> xx.userName = "SHJRERD";</div> <div> xx.statusId = 1;</div> <div> </div> <div> string xxx = client.submitMapDetails(xx);</div> <div> Response.Write("TRN NO :"+xxx.ToString());</div> <div> </div> <div> </div> <div> // }</div> <div> /* catch (Exception ex)</div> <div> {</div> <div> </div> <div> Response.Write("<center><b><h1 style=color:#FF0000>لا يوجد بيانات لهذا السند يرجى مراجعة قسم الانظمة</h1></b></center></br></br></br>");</div> <div> Response.Write(ex.ToString());</div> <div> // Response.Write("<script language=javascript>this.window.opener = null;window.open('','_self'); window.close(); </script>");</div> <div> //MsgBox("لا يوجد بيانات لهذا السند يرجى مراجعة قسم الانظمة");</div> <div> Response.End();</div> <div> }*/</div> <div> </div> <div> }</div> </div> <div></div> <div>------</div> <div>am getinf this error </div> <div> <div>System.NullReferenceException: 'Object reference not set to an instance of an object.'</div> <div> </div> <div>ServiceReference1.mapVO.ownerList.get returned null.</div> <div></div> <div></div> <div>please help i think there is somthing wrong of how to set the values</div> <div></div> <div>thanks</div> </div>Member
150 Points
103 Posts
Re: consume webservice wsdl
Jan 08, 2021 09:48 PM|SurferOnWww|LINK
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.
Participant
1031 Points
654 Posts
Re: consume webservice wsdl
Jan 08, 2021 11:54 PM|jzero|LINK
Search for asp.net webform consume wsdl.
Here a starting point
https://www.c-sharpcorner.com/UploadFile/0c1bb2/consuming-web-service-in-Asp-Net-web-application/
https://www.aspsnippets.com/Articles/Call-Consume-Web-Service-ASMX-in-ASPNet-web-application-using-C-and-VBNet.aspx
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 09, 2021 05:52 AM|hilal_w|LINK
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
Member
150 Points
103 Posts
Re: consume webservice wsdl
Jan 09, 2021 06:12 AM|SurferOnWww|LINK
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.
Participant
1031 Points
654 Posts
Re: consume webservice wsdl
Jan 09, 2021 12:15 PM|jzero|LINK
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
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 09, 2021 01:40 PM|hilal_w|LINK
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
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 09, 2021 01:58 PM|hilal_w|LINK
yes i have wsdl file or link and i need to produce service
All-Star
52091 Points
23207 Posts
Re: consume webservice wsdl
Jan 09, 2021 02:30 PM|mgebhard|LINK
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
Member
150 Points
103 Posts
Re: consume webservice wsdl
Jan 09, 2021 11:43 PM|SurferOnWww|LINK
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?
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 10, 2021 06:12 AM|hilal_w|LINK
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()); }
All-Star
52091 Points
23207 Posts
Re: consume webservice wsdl
Jan 10, 2021 12:49 PM|mgebhard|LINK
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.
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 10, 2021 01:02 PM|hilal_w|LINK
If i share it you can show me how please?
All-Star
52091 Points
23207 Posts
Re: consume webservice wsdl
Jan 10, 2021 01:09 PM|mgebhard|LINK
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.
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 10, 2021 03:19 PM|hilal_w|LINK
Thanks alot i will give try let you know the result
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 10, 2021 08:29 PM|hilal_w|LINK
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
All-Star
52091 Points
23207 Posts
Re: consume webservice wsdl
Jan 10, 2021 09:32 PM|mgebhard|LINK
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.
None
0 Points
13 Posts
Re: consume webservice wsdl
Jan 13, 2021 08:15 PM|hilal_w|LINK
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