TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Roy r
NA
64
170.1k
How to Consume REST based WCF Service ?
Jan 19 2011 7:44 AM
Hello guys ,
I would like to crate REST based WCF service for my application .
For that I've added
WebInvoke
and
WebGet
attributes to my methods as shown below .
------------------------------------------------------------------------------------
public interface IStudentService
{
[WebInvoke(Method = "POST", UriTemplate = "students")]
[OperationContract]
int Add(StudentProperty objStudentEntity);
[WebGet(UriTemplate = "students")]
[OperationContract]
DataTable FetchStudent();
[WebInvoke(Method = "DELETE", UriTemplate = "students/{studId}")]
[OperationContract]
int DeleteStudent(string studId);
[WebGet(UriTemplate = "students/{studId}")]
[OperationContract]
string GetOneStudent(string studId);
}
------------------------------------------------------------------------------------
Now I can easily test WebGetMethods( FetchStudent,GetOneStudent) by Url . For example following url will be used to fetch all student.
http://localhost:2251/StudentSVC.svc/students
Questions :
1. How can I consume it in C sharp ? For example how can I Fetch all students form code behind using above service ?
2. How can I test and consume methods marked with WebInvoke attributes ? I want to add students by using above service.
If any one knows then please tell me , and if possible then plz give sample code.
-Thanks
Reply
Answers (
1
)
How to create SOAP , REST in same webservice ?
Access NET Business logic from smartphones( Iphone,Android..)