I want to build a web service that to expose an API which will be consumed by another company in a Java application. I am kind of undecided whether to use WCF (SOAP) or Web API (REST). The client should be able to do CRUD operations and some of those operations
involve credit card payments using our API. Also, I am planning to use the same web service to build an app for iphone/android.
What are the advantages/disadvantages of using SOAP vs REST in this scenario?
Is it harder to consume SOAP services on mobile devices ?
Most importantly, what's the best way to authenticate the client?
I would suggest to use Web API. The main reason is because for mobile application the best way to consume services is using REST for which Web API is a perfect fit. WCF gives you the flexibility to use other protocols, but the REST implementation is a bit
more complicated.
When comparing SOAP vs REST, it has already been established (for many years) that REST is the better choice( lighter in size, uses the http verbs and routing techniques), and you can serialize to JSON.
Authentication is the same for both (WCF and Web API). You will need to pass credentials/tokens to ther server to maintain the authenticated state, but this should be decided based on your security requirements. For Web API, you can use a message handler
(my choice) or a authorization filter to handle the authentication and populate the user principal. Your controllers will just need to be decorated with the Authorize attribute for each action.
IMHO, consuming HTTP services(including REST and RPC) is very easier in every modern app. I was able to consume HTTP service from Andriod(Java), Iphone(Objective C), Windows Mobile 6(6.5 C# 3.0) clients very easily.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Most webservices are not REST. They perhaps are a little bit like REST, but usually they're just RPC style over HTTP. And there's absolutely nothing wrong with that!
I'd still stick to Web Api over WCF. It's easier to set up (web or selfhost), easier to configure (code, no configuration file) and easier to plug in (due to filter and dependency resolver).
HarishModugu
Member
116 Points
27 Posts
Web API or WCF suggestion!
Dec 03, 2012 07:37 PM|LINK
Hi friends,
I want to build a web service that to expose an API which will be consumed by another company in a Java application. I am kind of undecided whether to use WCF (SOAP) or Web API (REST). The client should be able to do CRUD operations and some of those operations involve credit card payments using our API. Also, I am planning to use the same web service to build an app for iphone/android.
What are the advantages/disadvantages of using SOAP vs REST in this scenario?
Is it harder to consume SOAP services on mobile devices ?
Most importantly, what's the best way to authenticate the client?
I really appreciate any help.
Thanks
ozkary
Contributor
2034 Points
303 Posts
Re: Web API or WCF suggestion!
Dec 04, 2012 01:21 AM|LINK
I would suggest to use Web API. The main reason is because for mobile application the best way to consume services is using REST for which Web API is a perfect fit. WCF gives you the flexibility to use other protocols, but the REST implementation is a bit more complicated.
When comparing SOAP vs REST, it has already been established (for many years) that REST is the better choice( lighter in size, uses the http verbs and routing techniques), and you can serialize to JSON.
Authentication is the same for both (WCF and Web API). You will need to pass credentials/tokens to ther server to maintain the authenticated state, but this should be decided based on your security requirements. For Web API, you can use a message handler (my choice) or a authorization filter to handle the authentication and populate the user principal. Your controllers will just need to be decorated with the Authorize attribute for each action.
hope this helps.
og-bit.com
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Web API or WCF suggestion!
Dec 04, 2012 03:01 AM|LINK
IMHO, consuming HTTP services(including REST and RPC) is very easier in every modern app. I was able to consume HTTP service from Andriod(Java), Iphone(Objective C), Windows Mobile 6(6.5 C# 3.0) clients very easily.
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
thaicarrot
Contributor
5128 Points
1463 Posts
Re: Web API or WCF suggestion!
Dec 04, 2012 07:19 PM|LINK
RestFull is more widely use in the futre Then SOAP is going to dead.
Weera
MartinJ.
Member
243 Points
80 Posts
Re: Web API or WCF suggestion!
Dec 04, 2012 07:23 PM|LINK
Most webservices are not REST. They perhaps are a little bit like REST, but usually they're just RPC style over HTTP. And there's absolutely nothing wrong with that!
I'd still stick to Web Api over WCF. It's easier to set up (web or selfhost), easier to configure (code, no configuration file) and easier to plug in (due to filter and dependency resolver).