I have a fundamental question on the REST implementation on the client side. Since we don't create proxy for the REST WCF services, how does the client know about the concrete types used in the server?
Example method is
[WebGet(UriTemplate="Customers")]
Customer GetCustomer();
how does the client knows about the Customer Type?. Do we need to explicity include the dll(Which contains the Customer Type definition) for the client side?
Ok. How does the schema sharing in WCF rest happens? I am just started with the WCF rest - so keen to know about this. If you can share some URL's / samples on this, it will be of great help
Thanks for your response. Here you have explained about a service created from your end and that is consumed by you only. So you have the library/ the information about types. But my concern is on the services created by someone else where we have no info
about his types.
Let me re-iterate, you're NOT supposed to know about the types.
You really need to try to understand core SOA principles, such as "Share schema, not type" and "Boundaries are explicit".
If you are using a 3rd party, REST-based service, they should publish, either in example form or via a simple schema document, what their operations are and what the expected incoming messages and the possible output message responses are.
tutumon79
Member
9 Points
23 Posts
How does REST client knows about the DataContracts used in the server
Feb 10, 2012 06:34 AM|LINK
I have a fundamental question on the REST implementation on the client side. Since we don't create proxy for the REST WCF services, how does the client know about the concrete types used in the server?
Example method is
[WebGet(UriTemplate="Customers")]
Customer GetCustomer();
how does the client knows about the Customer Type?. Do we need to explicity include the dll(Which contains the Customer Type definition) for the client side?
Tutumon
REST
DMW
All-Star
15943 Points
2353 Posts
Re: How does REST client knows about the DataContracts used in the server
Feb 10, 2012 08:54 AM|LINK
REST clients are NOT supposed to know about the concrete types in the server.
After all, the client and the server could be running completely different technologies.
Therefore, you will need to share schema, not class, between the client and the server.
REST
Dave
tutumon79
Member
9 Points
23 Posts
Re: How does REST client knows about the DataContracts used in the server
Feb 13, 2012 06:41 AM|LINK
Ok. How does the schema sharing in WCF rest happens? I am just started with the WCF rest - so keen to know about this. If you can share some URL's / samples on this, it will be of great help
REST
PAULSC
Member
41 Points
22 Posts
Re: How does REST client knows about the DataContracts used in the server
Feb 15, 2012 07:24 PM|LINK
Have a look at this link - it is from my blog where I ran into the same thought as you
http://developingmycloudapp.wordpress.com/2011/01/08/implementing-rest-web-services-part-1/
and part 2
http://developingmycloudapp.wordpress.com/2011/01/09/implementing-rest-web-services-part-2/
REST
tutumon79
Member
9 Points
23 Posts
Re: How does REST client knows about the DataContracts used in the server
Feb 16, 2012 07:44 AM|LINK
Thanks for your response. Here you have explained about a service created from your end and that is consumed by you only. So you have the library/ the information about types. But my concern is on the services created by someone else where we have no info about his types.
Tutumon
REST
DMW
All-Star
15943 Points
2353 Posts
Re: How does REST client knows about the DataContracts used in the server
Feb 16, 2012 12:19 PM|LINK
Let me re-iterate, you're NOT supposed to know about the types.
You really need to try to understand core SOA principles, such as "Share schema, not type" and "Boundaries are explicit".
If you are using a 3rd party, REST-based service, they should publish, either in example form or via a simple schema document, what their operations are and what the expected incoming messages and the possible output message responses are.
You cannot share types.
REST
Dave
DMW
All-Star
15943 Points
2353 Posts
Re: How does REST client knows about the DataContracts used in the server
Feb 16, 2012 12:24 PM|LINK
To help you out, here's a classic example of what a very well-known and respected organisation does for their REST-based API:
http://developer.37signals.com/basecamp/
No types: just documentation.
REST
Dave