Solved

wcf restful service

Posted on 2013-01-25
4
525 Views
Last Modified: 2013-01-28
How do you set up a wcf restful service so that if I call the service like so

http://domain/service.svc/patient/1

that it knows it is a get or a post?
0
Comment
Question by:JDEE8297
  • 2
  • 2
4 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 230 total points
Comment Utility
To be more precise, you are calling the service.svc service, but you are accessing the patient/1 resource.
You can access that resource with several HTTP methods: POST, PUT, GET, DELETE, etc.
GET is used for retrieving the resource, so the request message body is empty, while the response message contains the resource data
POST is used to send (create) the resource, so the request message contains the resource data, while the response message is empty
0
 

Author Comment

by:JDEE8297
Comment Utility
so that does that mean if you call the service like so


service.svc/patient

and call it from jquery as a post method, and pass in the json object on the post, that backend code will know which method to send it to in the service and handle it accordingly.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
The backend will know what to do with the resource 'service.svc/patient/1', based on the HTTP method. That's the correct usage of REST.
In summary: the URL contains the resource (the subject), and the HTTP method contains the action (the verb).
0
 

Author Closing Comment

by:JDEE8297
Comment Utility
thank you. :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now