I'm currently implementing a Silverlight application using WCF for the communication between client and server. I've heard that using WCF we're bound to use some Microsoft technology at the client side, and can't easily replace this with "anything" - at least with the default SOAP implementation of WPF.
So my questions are:
Just like Web Forms and other . NET Framework technologies, your WCF applications will continue to work for a long time. In fact, WCF will likely work for the next two decades thanks to . NET Framework being considered part of the windows operating system.
With WCF (Windows Communication Foundation) no longer being actively developed, gRPC (remote procedure call) appears to be the natural replacement when it comes to developing greenfield service applications on . NET Core and .
GRPC is better than WCF in terms of performance.
I'm apart of the core team that maintains ServiceStack - a mature Open Source alternative to WCF: modern, code-first, model-driven, WCF replacement web services framework encouraging code and remote best-practices for creating terse, DRY, high-perfomance, scalable REST web services.
It has automatic support JSON, JSONP, CORS headers as well as form-urlencoded/multipart-formdata. The Online Demos are a good start to look at since they all use Ajax.
In addition, there's no XML config, or code-gen and your 'write-once' C# web service provides all JSON, XML, SOAP, JSV, CSV, HTML endpoints enabled out-of-the-box, automatically with hooks to plug in your own Content Types if needed.
It also includes generic sync/async service clients providing a fast, typed, client/server communication gateway end-to-end.
This is the complete example of all the code needed to create a simple web service, that is automatically without any config, registered and made available on all the web data formats on pre-defined and custom REST-ful routes:
public class Hello : IReturn<HelloResponse>
{
public string Name { get; set; }
}
public class HelloResponse
{
public string Result { get; set; }
}
public class HelloService : Service
{
public object Get(Hello request)
{
return new HelloResponse { Result = "Hello, " + request.Name };
}
}
Above service can be called (without any build-steps/code-gen) in C# with the line below:
HelloResponse response = client.Get(new Hello { Name = "World!" });
response.Result.Print(); // => Hello, World
And in jQuery with:
$.getJSON('hello/World!', function(r){
alert(r.Result);
});
I've heard that using WCF we're bound to use some Microsoft technology at the client side
Well, then you've been lied to!
Many vendors and open source libraries support SOAP - it's a W3C standard, not a Microsoft-specific idea.
One great alternative for a RESTful service is ASP.NET MVC, which I've found a very easy way to expose methods directly as URLs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With