Thursday, January 3, 2019

Using a service reference as a data source in a c# web application

Hi,

I've been using a service reference as a data source in my .net core 2 console app for some time now with no issues.

But I can't figure out how to translate that success into a web app.

I have added a service reference, which has a method like this:

[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAirplaneManagement/GetAirplanesList", ReplyAction = "http://tempuri.org/IAirplaneManagement/GetAirplanesListResponse")] PanoptoAirplaneManagement.ListAirplanesResponse GetAirplanesList(AirplaneManagement.ListAirplanesRequest request); 

In my console app, it's really easy to just write out the data. I can just do this in my console app to display the data:

 ListAirplanesResponse airplanesResponse = GetAirplanesList(new AirplaneManagement.ListAirplanesRequest); foreach (airplane in airplanesResponse.Results) { Console.WriteLine("Airplane: " + airplane.Name + " | " + airplane.Engine); } 

But, how would I write out the data to a web app?

Thanks!

Using a service reference as a data source in a c# web application Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team