<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>WCF REST Starter Kit</title><link>http://forums.asp.net/1180.aspx</link><description>Discuss the WCF REST Starter Kit and other WCF REST topics.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: wcf rest collection - uri template</title><link>http://forums.asp.net/thread/3232652.aspx</link><pubDate>Mon, 15 Jun 2009 00:51:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3232652</guid><dc:creator>Krusty13000</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3232652.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1180&amp;PostID=3232652</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thank you so much Allen - it worked.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: wcf rest collection - uri template</title><link>http://forums.asp.net/thread/3228433.aspx</link><pubDate>Fri, 12 Jun 2009 12:19:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3228433</guid><dc:creator>cosophy@gmail.com</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3228433.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1180&amp;PostID=3228433</wfw:commentRss><description>&lt;p&gt;&amp;nbsp; Sorry, I have not seen an example using self-defined templates
except the defaults in Starter Kit 2. If you want to use your own UriTemplates, I think you can try in this way.&lt;/p&gt;&lt;p&gt;1. delete the default svc file and related code file.&lt;/p&gt;&lt;p&gt;2. add a new WCF Service item (3 files will be added, here suppose they are IService.cs, Service.svc and Service.svc.cs)&lt;/p&gt;&lt;p&gt;3. edit the content is the three files. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; IService.cs&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.ServiceModel;&lt;br /&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System.ServiceModel.Web;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwd"&gt;namespace&lt;/span&gt; CollectionService&lt;br /&gt;{&lt;br /&gt;    [ServiceContract]&lt;br /&gt;    &lt;span class="kwd"&gt;public interface&lt;/span&gt; IEmployeeService&lt;br /&gt;    {&lt;br /&gt;        [OperationContract]&lt;br /&gt;        [WebGet(UriTemplate = &lt;span class="st"&gt;&amp;quot;{id}&amp;quot;&lt;/span&gt;)]&lt;br /&gt;        &lt;span class="kwd"&gt;string&lt;/span&gt; GetEmployee(&lt;span class="kwd"&gt;string&lt;/span&gt; id);&lt;br /&gt;&lt;br /&gt;        [OperationContract]&lt;br /&gt;        [WebGet(UriTemplate = &lt;span class="st"&gt;&amp;quot;{id}/{departmentId}&amp;quot;&lt;/span&gt;)]&lt;br /&gt;        &lt;span class="kwd"&gt;string&lt;/span&gt; AddEmployee(&lt;span class="kwd"&gt;string&lt;/span&gt; id, &lt;span class="kwd"&gt;string&lt;/span&gt; departmentId);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Service.svc.cs&amp;nbsp; &lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwd"&gt;namespace&lt;/span&gt; CollectionService&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwd"&gt;public class&lt;/span&gt; Service :IEmployeeService&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; GetEmployee(&lt;span class="kwd"&gt;string&lt;/span&gt; id)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwd"&gt;return&lt;/span&gt; String.Format(&lt;span class="st"&gt;&amp;quot;U R requesting employee &amp;#39;{0}&amp;#39;&amp;quot;&lt;/span&gt;, id);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class="kwd"&gt;public string&lt;/span&gt; AddEmployee(&lt;span class="kwd"&gt;string&lt;/span&gt; id, &lt;span class="kwd"&gt;string&lt;/span&gt; departmentId)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwd"&gt;return&lt;/span&gt; String.Format(&lt;span class="st"&gt;&amp;quot;U R requesting employee &amp;#39;{0}&amp;#39; department &amp;#39;{1}&amp;#39;&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="coloredcode"&gt;&lt;span class="st"&gt;&lt;/span&gt;                                                , id, departmentId);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Service. svc&amp;nbsp; ( Add the WebServiceHostFactory)&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&amp;lt;%@ ServiceHost Language=&lt;span class="st"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; Debug=&lt;span class="st"&gt;&amp;quot;true&amp;quot;&lt;/span&gt; Service=&lt;span class="st"&gt;&amp;quot;CollectionService.Service&amp;quot;&lt;/span&gt; &lt;/pre&gt;&lt;pre class="coloredcode"&gt;CodeBehind=&lt;span class="st"&gt;&amp;quot;Service.svc.cs&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Factory=&lt;span class="st"&gt;&amp;quot;System.ServiceModel.Activation.WebServiceHostFactory&amp;quot;&lt;/span&gt;%&amp;gt; &amp;nbsp;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;4. At last, delete the tag&amp;nbsp; and its content in the config file. &lt;br /&gt;&lt;br /&gt;5. View Service.svc in browser , and add &amp;quot;/ddd&amp;quot; or &amp;quot;/ddd/eee&amp;quot; to the end of the URI you will see: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;string xmlns=&amp;quot;http://schemas.microsoft.com/2003/10/Serialization/&amp;quot;&amp;gt;U R requesting employee &amp;#39;ddd&amp;#39;&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; and&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;string xmlns=&amp;quot;http://schemas.microsoft.com/2003/10/Serialization/&amp;quot;&amp;gt;U R requesting employee &amp;#39;ddd&amp;#39; department &amp;#39;eee&amp;#39;&amp;lt;/string&amp;gt; &lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Besides, you can also install the Starter Kit Preview 1, because it automatically adds a &amp;#39;service.base.svc.cs&amp;#39; file, in which you can modify the UriTemplates .&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: wcf rest collection - uri template</title><link>http://forums.asp.net/thread/3226762.aspx</link><pubDate>Thu, 11 Jun 2009 21:58:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3226762</guid><dc:creator>Krusty13000</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3226762.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1180&amp;PostID=3226762</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Allen,&lt;/p&gt;&lt;p&gt;do you know where there is an example of this?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;&lt;p&gt;Krusty. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: wcf rest collection - uri template</title><link>http://forums.asp.net/thread/3224609.aspx</link><pubDate>Thu, 11 Jun 2009 05:50:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3224609</guid><dc:creator>cosophy@gmail.com</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3224609.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1180&amp;PostID=3224609</wfw:commentRss><description>&lt;p&gt;The kit uses the default ServiceContract &amp;quot;ICollectionService&amp;lt;ITem&amp;gt;&amp;quot; where you modify your OperationContract. But it is compiled into Microsoft.ServiceModel.Web.dll. So you can not modify the default service contract. &lt;/p&gt;&lt;p&gt;You just need to add another service contract in your project, and put in your operation contract including the template. Don&amp;#39;t forget to use this service contract by making the service inherit to it.&lt;/p&gt;&lt;p&gt;Allen Wang &lt;br /&gt;&lt;/p&gt;</description></item><item><title>wcf rest collection - uri template</title><link>http://forums.asp.net/thread/3224427.aspx</link><pubDate>Thu, 11 Jun 2009 03:52:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3224427</guid><dc:creator>Krusty13000</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3224427.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1180&amp;PostID=3224427</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello,&lt;/p&gt;&lt;p&gt;can anyone tell me where in the rest starter kit 2 how I modify the uri template to accept two parameters? so the uri will be for the get ...&lt;/p&gt;&lt;p&gt;http://localhost:25000/Service.svc/5/3&lt;/p&gt;&lt;p&gt;where 5 will be the employee id and 3 the department id.&lt;/p&gt;&lt;p&gt;I am not sure where to modify the template anymore?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>