?
Solved

wcf restful service

Posted on 2013-01-25
4
Medium Priority
?
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 920 total points
ID: 38822144
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
ID: 38826068
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
ID: 38826591
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
ID: 38826612
thank you. :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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