Hi
I am trying to learn Blazor having done Web Forms for many years. So I appologise if my question is somehwhat basic.
I have a web service in an old web forms app, I am exposing the Data Access Layer via a asmx web service using the below
<WebMethod(MessageName:="Get Stats", Description:="Get stats on all vehicles")>
Public Function GetVehiclesStats() As Dataset
Return DAL.VehicleLog.ReportVehiclesStats()
End Function
I am then trying to consume the web service from my Blazor app, I have added the service to my Connected Services, naming it wsRW. I can call the web service fine to bring back a string value (hello world). But when I try and call the dataset it seems to
think its an ArrayOfXElement rather than a dataset. My code is below:
wsRW.wsRoadwatchSoapClient ws = new wsRW.wsRoadwatchSoapClient(wsRW.wsRoadwatchSoapClient.EndpointConfiguration.wsRoadwatchSoap);
wsRW.ArrayOfXElement a = ws.GetVehiclesStats(); //This works but is not a dataset
System.Data.DataSet ds = ws.GetVehiclesStats(); //This fails
Yeah, SOAP web services are no longer a thing and therefore not available with cross platform .NET Core (they are available in .NET Framework), you will need to either migrate existing ASMX to WebApi or make some sort of abstraction, like add new WebApi
endpoints to existing SOAP project (they can work together just fine), consume ASMX there (in your WebApi endpoint), transform it to JSON, and return it as a result.
More info about adding Web Api to WebForms project:
Member
29 Points
319 Posts
New to Blazor, consume soap web service from Blazor
Jun 21, 2020 05:07 PM|BigMeat|LINK
Hi
I am trying to learn Blazor having done Web Forms for many years. So I appologise if my question is somehwhat basic.
I have a web service in an old web forms app, I am exposing the Data Access Layer via a asmx web service using the below
<WebMethod(MessageName:="Get Stats", Description:="Get stats on all vehicles")>
Public Function GetVehiclesStats() As Dataset
Return DAL.VehicleLog.ReportVehiclesStats()
End Function
I am then trying to consume the web service from my Blazor app, I have added the service to my Connected Services, naming it wsRW. I can call the web service fine to bring back a string value (hello world). But when I try and call the dataset it seems to think its an ArrayOfXElement rather than a dataset. My code is below:
wsRW.wsRoadwatchSoapClient ws = new wsRW.wsRoadwatchSoapClient(wsRW.wsRoadwatchSoapClient.EndpointConfiguration.wsRoadwatchSoap);
wsRW.ArrayOfXElement a = ws.GetVehiclesStats(); //This works but is not a dataset
System.Data.DataSet ds = ws.GetVehiclesStats(); //This fails
Any idea how I can solve this issue.
Many thanks in advance
All-Star
58464 Points
15785 Posts
Re: New to Blazor, consume soap web service from Blazor
Jun 24, 2020 06:38 PM|bruce (sqlwork.com)|LINK
its a feature lost with the .net core. follow this thread:
https://github.com/dotnet/wcf/issues/3712
Member
10 Points
9 Posts
Re: New to Blazor, consume soap web service from Blazor
Jun 25, 2020 08:56 AM|zoran123456|LINK
Yeah, SOAP web services are no longer a thing and therefore not available with cross platform .NET Core (they are available in .NET Framework), you will need to either migrate existing ASMX to WebApi or make some sort of abstraction, like add new WebApi endpoints to existing SOAP project (they can work together just fine), consume ASMX there (in your WebApi endpoint), transform it to JSON, and return it as a result.
More info about adding Web Api to WebForms project:
https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/using-web-api-with-aspnet-web-forms