How does REST client knows about the DataContracts used in the serverhttp://forums.asp.net/t/1768027.aspx/1?How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverThu, 16 Feb 2012 12:24:15 -050017680274825707http://forums.asp.net/p/1768027/4825707.aspx/1?How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverHow does REST client knows about the DataContracts used in the server <p>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?</p> <p>Example method is</p> <p>[WebGet(UriTemplate=&quot;Customers&quot;)]</p> <p>Customer GetCustomer();</p> <p>how does the client knows about the Customer Type?. Do we need to explicity include the dll(Which contains the Customer Type definition)&nbsp;for the client side?</p> <p>Tutumon</p> 2012-02-10T06:34:56-05:004825922http://forums.asp.net/p/1768027/4825922.aspx/1?Re+How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverRe: How does REST client knows about the DataContracts used in the server <p>REST clients are NOT supposed to know about the concrete types in the server.</p> <p>After all, the client and the server could be running completely different technologies.</p> <p>Therefore, you will need to share schema, not class, between the client and the server.</p> 2012-02-10T08:54:48-05:004829143http://forums.asp.net/p/1768027/4829143.aspx/1?Re+How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverRe: How does REST client knows about the DataContracts used in the server <p>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</p> <p>&nbsp;</p> 2012-02-13T06:41:05-05:004834489http://forums.asp.net/p/1768027/4834489.aspx/1?Re+How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverRe: How does REST client knows about the DataContracts used in the server <p>Have a look at this link - it is from my blog where I ran into the same thought as you</p> <p>&nbsp;</p> <p><a href="http://developingmycloudapp.wordpress.com/2011/01/08/implementing-rest-web-services-part-1/">http://developingmycloudapp.wordpress.com/2011/01/08/implementing-rest-web-services-part-1/</a></p> <p>&nbsp;</p> <p>and part 2</p> <p>&nbsp;</p> <p><a href="http://developingmycloudapp.wordpress.com/2011/01/09/implementing-rest-web-services-part-2/">http://developingmycloudapp.wordpress.com/2011/01/09/implementing-rest-web-services-part-2/</a></p> <p>&nbsp;</p> <p>&nbsp;</p> 2012-02-15T19:24:20-05:004835348http://forums.asp.net/p/1768027/4835348.aspx/1?Re+How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverRe: How does REST client knows about the DataContracts used in the server <p>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.</p> <p>Tutumon</p> 2012-02-16T07:44:35-05:004835880http://forums.asp.net/p/1768027/4835880.aspx/1?Re+How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverRe: How does REST client knows about the DataContracts used in the server <p>Let me re-iterate, you're NOT supposed to know about the types.</p> <p>You really need to try to understand core SOA principles, such as &quot;Share schema, not type&quot; and &quot;Boundaries are explicit&quot;.</p> <p>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.</p> <p>You cannot share types.</p> 2012-02-16T12:19:25-05:004835887http://forums.asp.net/p/1768027/4835887.aspx/1?Re+How+does+REST+client+knows+about+the+DataContracts+used+in+the+serverRe: How does REST client knows about the DataContracts used in the server <p>To help you out, here's a classic example of what a very well-known and respected organisation does for their REST-based API:</p> <p>http://developer.37signals.com/basecamp/</p> <p>No types: just documentation.</p> 2012-02-16T12:24:15-05:00