<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: REST in WCF &#8211; Part VII (HI-REST &#8211; Implementing Insert and Update)</title>
	<atom:link href="http://www.robbagby.com/rest/rest-in-wcf-part-vii-hi-rest-implementing-insert-and-update/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robbagby.com/rest/rest-in-wcf-part-vii-hi-rest-implementing-insert-and-update/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 22 Feb 2010 12:30:54 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: RobBagby</title>
		<link>http://www.robbagby.com/rest/rest-in-wcf-part-vii-hi-rest-implementing-insert-and-update/comment-page-1/#comment-453</link>
		<dc:creator>RobBagby</dc:creator>
		<pubDate>Thu, 05 Nov 2009 13:27:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.robbagby.com/rest/rest-in-wcf-part-vii-hi-rest-implementing-insert-and-update/#comment-453</guid>
		<description>Hi Bryce,
It appears that you are mixing a few technologies.  The ScriptServiceAttribute applies to calling asmx web services via JavaScript.  UriTemplates apply to WCF services.  They don&#039;t intermix well.
A bit more information... If you are planning on calling WCF services from JavaScript, you have a couple of choices.  The easiest is to use what I refer to as the &#039;AJAX-Friendly&#039; endpoint behavior: enableWebScript.  I am assuming you have seen these, but I outlined this functionality in part II and part III of this series: http://www.robbagby.com/rest/rest-in-wcf-part-ii-ajax-friendly-services-creating-the-service/ and http://www.robbagby.com/rest/rest-in-wcf-part-iii-ajax-friendly-services-consuming-the-service/.  This endpoint behavior will automatically generate a JavaScript proxy for you. In doing that, it precludes you from using PUT / DELETE, etc.  Essentially, it only supports GET and POST.  Further, it does not support UriTemplates.

Hope that helps!

Rob</description>
		<content:encoded><![CDATA[<p>Hi Bryce,<br />
It appears that you are mixing a few technologies.  The ScriptServiceAttribute applies to calling asmx web services via JavaScript.  UriTemplates apply to WCF services.  They don&#8217;t intermix well.<br />
A bit more information&#8230; If you are planning on calling WCF services from JavaScript, you have a couple of choices.  The easiest is to use what I refer to as the &#8216;AJAX-Friendly&#8217; endpoint behavior: enableWebScript.  I am assuming you have seen these, but I outlined this functionality in part II and part III of this series: <a href="http://www.robbagby.com/rest/rest-in-wcf-part-ii-ajax-friendly-services-creating-the-service/" rel="nofollow">http://www.robbagby.com/rest/rest-in-wcf-part-ii-ajax-friendly-services-creating-the-service/</a> and <a href="http://www.robbagby.com/rest/rest-in-wcf-part-iii-ajax-friendly-services-consuming-the-service/" rel="nofollow">http://www.robbagby.com/rest/rest-in-wcf-part-iii-ajax-friendly-services-consuming-the-service/</a>.  This endpoint behavior will automatically generate a JavaScript proxy for you. In doing that, it precludes you from using PUT / DELETE, etc.  Essentially, it only supports GET and POST.  Further, it does not support UriTemplates.</p>
<p>Hope that helps!</p>
<p>Rob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tono</title>
		<link>http://www.robbagby.com/rest/rest-in-wcf-part-vii-hi-rest-implementing-insert-and-update/comment-page-1/#comment-437</link>
		<dc:creator>tono</dc:creator>
		<pubDate>Wed, 04 Nov 2009 00:47:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.robbagby.com/rest/rest-in-wcf-part-vii-hi-rest-implementing-insert-and-update/#comment-437</guid>
		<description>Hey Rob,
Thanks for the great information on REST and WCF.  I have a quick question with regard to UriTemplates, PUT&#039;s&#124;&#124;POST&#039;s, and a RequestFormat of json:  my application keeps throwing the error: &quot;Only Web services with a [ScriptService] attribute on the class definition can be called from script.&quot;.

In looking at the RestHandler under System.Web.Script.Services the IsRestMethod will always return true if the contenttype is set to json:
    internal static bool IsRestMethodCall(HttpRequest request)
    {
        if (string.IsNullOrEmpty(request.PathInfo))
        {
            return false;
        }
        if (!request.ContentType.StartsWith(&quot;application/json;&quot;, StringComparison.OrdinalIgnoreCase))
        {
            return string.Equals(request.ContentType, &quot;application/json&quot;, StringComparison.OrdinalIgnoreCase);
        }
        return true;
    }

Since you can&#039;t use the [ScriptService] attribute with uritemplates - I&#039;m assuming I&#039;m missing something totally obvious.  Any pointers?  

thanks,
Bryce</description>
		<content:encoded><![CDATA[<p>Hey Rob,<br />
Thanks for the great information on REST and WCF.  I have a quick question with regard to UriTemplates, PUT&#8217;s||POST&#8217;s, and a RequestFormat of json:  my application keeps throwing the error: &#8220;Only Web services with a [ScriptService] attribute on the class definition can be called from script.&#8221;.</p>
<p>In looking at the RestHandler under System.Web.Script.Services the IsRestMethod will always return true if the contenttype is set to json:<br />
    internal static bool IsRestMethodCall(HttpRequest request)<br />
    {<br />
        if (string.IsNullOrEmpty(request.PathInfo))<br />
        {<br />
            return false;<br />
        }<br />
        if (!request.ContentType.StartsWith(&#8221;application/json;&#8221;, StringComparison.OrdinalIgnoreCase))<br />
        {<br />
            return string.Equals(request.ContentType, &#8220;application/json&#8221;, StringComparison.OrdinalIgnoreCase);<br />
        }<br />
        return true;<br />
    }</p>
<p>Since you can&#8217;t use the [ScriptService] attribute with uritemplates &#8211; I&#8217;m assuming I&#8217;m missing something totally obvious.  Any pointers?  </p>
<p>thanks,<br />
Bryce</p>
]]></content:encoded>
	</item>
</channel>
</rss>