简体   繁体   中英

What are the 'intended' WCF web service consumers?

I have been given a task to display data on an ASP .net page on page load from a WCF web service that returns SOAP XML. I've coded the web service, and it succesfully returns a List. The discussion now is down to how I consume the service. Naturally - I feel like I want to do this server-side on PageLoad and populate a table that way. But I get the impression that the whole concept of WCF web services with a SOAP XML response is to provide client-side script to invoke methods to receive these lists? Is it common for WCF web services to be invoke/consumed by C# server-side?

Yes, it is very common for servers to consume other services. A service is just a place for you to get some information, regardless of whom is consuming it. In the case you are describing, your 'server' IS the 'client' of the service.

If the Service produces SOAP, consume it on your Serverside.

If it is a JSON (RSS, POX) service you can directly use JavaScript.

But of course the required processing / storage also plays a roll in this decision.

It also depends upon how you want your page to function. My last job was working on an ASP.NET app and our customers HATED all of the postbacks. If you consume the WCF service server-side and the page requires frequent updates then each update will require a postback. There's nothing wrong with that, it's just a trade off. If you want updates to yield a smoother user experience then you can consume the WCF service client-side via AJAX. It all depends on what you want your user experience to be like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM