简体   繁体   中英

Which is the best way (WCF or WEB API) to send data(complex data/primitive data) to a service and get the response(complex data/primitive data)

I have one scenario, Let Say A is a Web based Application and needs to show some data on screen based on data returned from component B. Now A send some data(which is going to be input parameter for a component B) on an event to B , and component B is going to do calculation on input parameter and return data to A. Both A and B are handled by different organization, So what is the best way to communicate between them, is WCF or WEB API(also suggest how can we implement this scenario)?

I am thinking of creating Web API for component B here , so that A can consume that and call component B,and Transfer data in JSON format. But the issue in this approach is that, this request is going to be GET Request, and we can't send complex types on GET request. Even if we are communicating through JSON format, how can we send huge data in GET request.Please correct me if mine understanding is wrong.

No of Input Parameter is ranging between 10 to 20 and number of request made to Component B is very much frequent, So we have to take care of performance as well.

Updatde 1: First Issue is we can't send data in Request Body for GET.

Generally the question is WCF for complexity and security vs WebApi for simplicity and speed . If WCF features are not required, I will go for WebApi. If you need to send complex data with request, you can use POST.

It is perfectly correct to request data using POST, there are only small limitations.
Look here: https://www.w3schools.com/jquery/jquery_ajax_get_post.asp

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