Solved

wcf restful service

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 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

18 Experts available now in Live!

Get 1:1 Help Now