WebAPI isn't about objects and methods -- it's about HTTP. HTTP has a request and a response. So the way to think about this is that you can send a request and you can get back a response.
Well said dear! I got your point... So, in wcf which uses SOAP, has more options... we can define out parameters which it adds in response automatically... What would you say about this? Asking from general concept clarifcation....
Actually, I have some services which are exposed by WCF on SOAP. Now, I am providng the REST interface for same services. We were using some out parameters of basic types (i.e. string, int etc.) in some methods and when I tried the same method signature
in Web API, it was failing while making a call. So, I just wanted to confirm is there any way to do so or is it incorrect in REST world...
I imagine the corollary in the Web API world would be to return a Tuple containing the multiple values you want to return. That's about as much as I can offer, as I've never used out parameters in WCF and don't understand exactly how that would correctly
format a response.
muhamad_ahsa...
Member
3 Points
12 Posts
Out Parameters in Web API
Dec 23, 2012 07:49 AM|LINK
Hi guys!
Is it possible to hae out parameters in web API action? If yes, then how to make a call to this action?
BrockAllen
All-Star
27526 Points
4903 Posts
MVP
Re: Out Parameters in Web API
Dec 23, 2012 12:38 PM|LINK
WebAPI isn't about objects and methods -- it's about HTTP. HTTP has a request and a response. So the way to think about this is that you can send a request and you can get back a response.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
muhamad_ahsa...
Member
3 Points
12 Posts
Re: Out Parameters in Web API
Dec 23, 2012 12:44 PM|LINK
Well said dear! I got your point... So, in wcf which uses SOAP, has more options... we can define out parameters which it adds in response automatically... What would you say about this? Asking from general concept clarifcation....
BrockAllen
All-Star
27526 Points
4903 Posts
MVP
Re: Out Parameters in Web API
Dec 23, 2012 12:58 PM|LINK
I'd almost say the same thing about SOAP -- it's a messaging protocol. The main difference is that WebAPI is closer to the protocol than WCF.
I'd suggest going thru the tutorials: http://www.asp.net/web-api
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
muhamad_ahsa...
Member
3 Points
12 Posts
Re: Out Parameters in Web API
Dec 23, 2012 01:00 PM|LINK
Thanks a lot for your kind response! :)
panesofglass
Member
730 Points
237 Posts
Re: Out Parameters in Web API
Dec 23, 2012 03:19 PM|LINK
muhamad_ahsa...
Member
3 Points
12 Posts
Re: Out Parameters in Web API
Dec 23, 2012 03:38 PM|LINK
Actually, I have some services which are exposed by WCF on SOAP. Now, I am providng the REST interface for same services. We were using some out parameters of basic types (i.e. string, int etc.) in some methods and when I tried the same method signature in Web API, it was failing while making a call. So, I just wanted to confirm is there any way to do so or is it incorrect in REST world...
panesofglass
Member
730 Points
237 Posts
Re: Out Parameters in Web API
Dec 30, 2012 04:33 AM|LINK
I imagine the corollary in the Web API world would be to return a Tuple containing the multiple values you want to return. That's about as much as I can offer, as I've never used out parameters in WCF and don't understand exactly how that would correctly format a response.