0

I have not configured an environment before. However, I have worked in an environment which is restful and basically calling the service was as bare-bone as calling the service URL using AJAX calls from the javascript.

Now, I am in a WCF environment and I am laying out the service here. It sounds like WCF requires a lot of configuration on the client side including a client proxy class (I guess for each service that we want to call?)

This is a lot of boilerplate code that I am going to write here. That is fine but out of curiosity I am just wondering that what is advantage of using WCF and its client Proxies as oppose to simple RestFUL AJAX calls which will return JSON objects to your Javascript. Also this produces more questions like:

  1. Can I use WCF with javascript/AJAX environment? Because there is no way that Javascript is going to be able to create a proxy for it
  2. Even ASMX model was not requiring proxy. Then why WCF added this proxy? what advantage does WCF/proxy have compared to ASMX without any proxy?
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Lost
  • 12,007
  • 32
  • 121
  • 193
  • 2
    Note that your question boils down to "why someone ever would want strongly typed contract to call/expose services" and as such it sounds strictly personal opinion question... WCF allows you to use strongly typed contracts to talk with/expose XML/JSON services - so not sure why it is a problem... It even builds JavaScript proxy for you if your really need to go such route - http://www.codeproject.com/Articles/627082/How-to-Consume-WCF-Service-using-JavaScript-Proxy... instead of JSON - http://stackoverflow.com/questions/5497412/consuming-json-in-wcf-service-method – Alexei Levenkov Dec 04 '14 at 19:35
  • 1
    WCF was created mainly as a **SOAP** based web service platform - and it chose to use client-side proxies (which make a lot of sense in the SOAP world). The support for REST was added only much later and it wasn't possible to completely change the basic implementation patterns of WCF. – marc_s Dec 04 '14 at 21:27
  • 1
    Calling a webservice that exposes a WSDL is not much effort or code at all. I can do it in 1-2 minutes in a fresh console app. Try to repeat that with your REST service. – usr Dec 04 '14 at 21:35

0 Answers0