Solved

wcf restful service

Posted on 2013-01-25
4
528 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 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