Brij
Brij

Reputation: 6122

Pros and cons of using JSON for WCF service

What are the pros and cons of the following 2 cases:

Case I:

Traditional way: Add service reference in project. Create object and Get data from service on server side and bind to asp.net grid.

Case II:

Update Service for JSON behavior. Add service reference in project. Call service from javascript to get data. Bind data to jquery grid.

Which one is the best approach and why?(Not developer point of view)

If there is another approach which is more optimized, please explain it and consider for large data.

Upvotes: 0

Views: 1054

Answers (2)

Joo Park
Joo Park

Reputation: 3155

second approach. any client can now consume that data, whether it'd be jquery grid or even an iphone client.

Upvotes: 0

Marc Gravell
Marc Gravell

Reputation: 1063734

It depends on whether end-clients (browsers) are allowed to have access to the WCF data service, or just the app service. For simple security modes, having json allows a lot of very simply jQuery etc scenarios.

Of course, jQuery etc demands a compatible browser; these days that means "most", but by no means "all". So if you want to provide the same data to dumb browsers you'll need a way to get the data at the server.

If the intend is to provide server-to-server (B2B etc) access, json is generally a second choice; xml (SOAP etc) would be the de-facto standard, but it isn't the only option. For example, if you have high bandwidth needs you might choose a more compact binary transmission format (there are many).

Upvotes: 2

Related Questions