<?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: WCF POX, JSON and SOAP Coexist</title>
	<atom:link href="http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html</link>
	<description>programming, software &#38; problem solving</description>
	<lastBuildDate>Fri, 10 Sep 2010 10:12:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Admin</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-7041</link>
		<dc:creator>Admin</dc:creator>
		<pubDate>Wed, 14 Jul 2010 21:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-7041</guid>
		<description>It should be the same way to handle the exceptions.
There is no difference at the code level( c# ), the difference is at the configuration level. e.g. which endpoint, binding do you use for talking to the webservice.</description>
		<content:encoded><![CDATA[<p>It should be the same way to handle the exceptions.<br />
There is no difference at the code level( c# ), the difference is at the configuration level. e.g. which endpoint, binding do you use for talking to the webservice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bunty</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-7039</link>
		<dc:creator>Bunty</dc:creator>
		<pubDate>Wed, 14 Jul 2010 18:42:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-7039</guid>
		<description>What is the best way to handle exceptions for both SOAP and REST together?

How do you differentiate between SOAP call and REST call to a specific operation? so that we can handle them appropriately and send proper response back such as custom fault for SOAP and some standard Http response back for REST type of request.

This is something very urgent and quick help would be really appreciated.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>What is the best way to handle exceptions for both SOAP and REST together?</p>
<p>How do you differentiate between SOAP call and REST call to a specific operation? so that we can handle them appropriately and send proper response back such as custom fault for SOAP and some standard Http response back for REST type of request.</p>
<p>This is something very urgent and quick help would be really appreciated.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-6780</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 09 Jul 2010 22:33:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-6780</guid>
		<description>you will need TestService.svc file for your service implementation and the baseAddress=&quot;http://localhost:81/TestService.svc&quot;
So the endpoints are
http://localhost:81/TestService.svc/soap
http://localhost:81/TestService.svc/pox
http://localhost:81/TestService.svc/json</description>
		<content:encoded><![CDATA[<p>you will need TestService.svc file for your service implementation and the baseAddress=&#8221;http://localhost:81/TestService.svc&#8221;<br />
So the endpoints are<br />
<a href="http://localhost:81/TestService.svc/soap" rel="nofollow">http://localhost:81/TestService.svc/soap</a><br />
<a href="http://localhost:81/TestService.svc/pox" rel="nofollow">http://localhost:81/TestService.svc/pox</a><br />
<a href="http://localhost:81/TestService.svc/json" rel="nofollow">http://localhost:81/TestService.svc/json</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bunty</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-6770</link>
		<dc:creator>Bunty</dc:creator>
		<pubDate>Fri, 09 Jul 2010 20:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-6770</guid>
		<description>What would be difference if I am looking to host this service with multiple endpoints in IIS? A quick answer to this would be really helpful.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>What would be difference if I am looking to host this service with multiple endpoints in IIS? A quick answer to this would be really helpful.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zaro</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-4819</link>
		<dc:creator>Zaro</dc:creator>
		<pubDate>Fri, 12 Mar 2010 08:48:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-4819</guid>
		<description>Great article, helps me with error: 
HTTP Error 405 Method not allowed - I&#039;ve changed the client proxy interface decorated methods with [System.ServiceModel.Web.WebGet].
To make example work for me, I&#039;ve changed the config paths:
/I&#039;ve received error like: has zero application (non-infrastructure) endpoints./
from: /service config/

to

and: /client config/
&lt;endpoint address=&quot;http://localhost:81/TestService/soap&quot; 
to
&lt;endpoint address=&quot;http://localhost:81/TestService.svc/soap&quot; 

Thanks for the post!</description>
		<content:encoded><![CDATA[<p>Great article, helps me with error:<br />
HTTP Error 405 Method not allowed &#8211; I&#8217;ve changed the client proxy interface decorated methods with [System.ServiceModel.Web.WebGet].<br />
To make example work for me, I&#8217;ve changed the config paths:<br />
/I&#8217;ve received error like: has zero application (non-infrastructure) endpoints./<br />
from: /service config/</p>
<p>to</p>
<p>and: /client config/<br />
&lt;endpoint address=&quot;http://localhost:81/TestService/soap&quot;<br />
to<br />
&lt;endpoint address=&quot;http://localhost:81/TestService.svc/soap&quot; </p>
<p>Thanks for the post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web Design, Manchester</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-4661</link>
		<dc:creator>Web Design, Manchester</dc:creator>
		<pubDate>Sun, 28 Feb 2010 09:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-4661</guid>
		<description>Great article - keep them coming please</description>
		<content:encoded><![CDATA[<p>Great article &#8211; keep them coming please</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Database Consultant</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-4152</link>
		<dc:creator>Database Consultant</dc:creator>
		<pubDate>Thu, 31 Dec 2009 11:15:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-4152</guid>
		<description>Very nice post.  WCF is pretty versatile.  I&#039;ve been able to get SOAP and REST working together nicely now.</description>
		<content:encoded><![CDATA[<p>Very nice post.  WCF is pretty versatile.  I&#8217;ve been able to get SOAP and REST working together nicely now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joan</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-3449</link>
		<dc:creator>Joan</dc:creator>
		<pubDate>Mon, 09 Nov 2009 10:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-3449</guid>
		<description>Thanks that helped to understand a bit more.

Finally I got the array doing this eventhough I don&#039;t really get why should work this way . . .

 var jsonstring = xmlHttp.responseText;
 var comboitem = eval(&#039; (&#039; + jsonstring + &#039; ) &#039;);

$(&#039;#resp_DGO&#039;).empty();

$.each(comboitem.d, function(i) {                          $(&#039;#resp_DGO&#039;).append(&#039; &#039; + comboitem.d[i].Name + &#039;&#039;);
})

Thanks for the great post!</description>
		<content:encoded><![CDATA[<p>Thanks that helped to understand a bit more.</p>
<p>Finally I got the array doing this eventhough I don&#8217;t really get why should work this way . . .</p>
<p> var jsonstring = xmlHttp.responseText;<br />
 var comboitem = eval(&#8216; (&#8216; + jsonstring + &#8216; ) &#8216;);</p>
<p>$(&#8216;#resp_DGO&#8217;).empty();</p>
<p>$.each(comboitem.d, function(i) {                          $(&#8216;#resp_DGO&#8217;).append(&#8216; &#8216; + comboitem.d[i].Name + &#8221;);<br />
})</p>
<p>Thanks for the great post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-3425</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 06 Nov 2009 20:00:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-3425</guid>
		<description>@Joan, 
The &quot;d&quot; is an array with one element
try this 
&lt;code&gt;
var result = {”d”:[{&quot;__type&quot;:&quot;ComboItem&quot;,&quot;Id&quot;:&quot;ECL&quot;,&quot;Name&quot;:&quot;Es-----ro&quot;}]};
alert(result.d[0].Id);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@Joan,<br />
The &#8220;d&#8221; is an array with one element<br />
try this </p>
<div class="codesnip-container" >var result = {”d”:[{"__type":"ComboItem","Id":"ECL","Name":"Es-----ro"}]};<br />
alert(result.d[0].Id);</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joan</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-3414</link>
		<dc:creator>Joan</dc:creator>
		<pubDate>Fri, 06 Nov 2009 12:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-3414</guid>
		<description>Sorry but I am stucked in trying to get the info out of this data:

{&quot;d&quot;:[{&quot;__type&quot;:&quot;ComboItem:http:\/\/schemas.---------------\/2009\/07\/30\/ComboItem&quot;,&quot;Id&quot;:&quot;ECL&quot;,&quot;Name&quot;:&quot;Es-----ro&quot;}]}

what should I use in the javascript to get my ComboItem.id and .Name fullfiled with values.

Thanks a lot!</description>
		<content:encoded><![CDATA[<p>Sorry but I am stucked in trying to get the info out of this data:</p>
<p>{&#8220;d&#8221;:[{"__type":"ComboItem:http:\/\/schemas.---------------\/2009\/07\/30\/ComboItem","Id":"ECL","Name":"Es-----ro"}]}</p>
<p>what should I use in the javascript to get my ComboItem.id and .Name fullfiled with values.</p>
<p>Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-2093</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 21 Jul 2009 23:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-2093</guid>
		<description>Hi Dave, I think what AllanC wants to do is to make the url a lot more nicer. In your case, if UriTemplated, it could look like
&lt;code&gt;../RecordMetric/1/123/40&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi Dave, I think what AllanC wants to do is to make the url a lot more nicer. In your case, if UriTemplated, it could look like</p>
<div class="codesnip-container" >../RecordMetric/1/123/40</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-2091</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 21 Jul 2009 15:32:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-2091</guid>
		<description>Wow it really killed my URL... let me try that again:

&lt;code&gt;
mysever:someportnumber/service/RecordMetric?learnerId=1&amp;metricId=123&amp;value=40

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Wow it really killed my URL&#8230; let me try that again:</p>
<div class="codesnip-container" >mysever:someportnumber/service/RecordMetric?learnerId=1&amp;metricId=123&amp;value=40</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-2090</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 21 Jul 2009 15:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-2090</guid>
		<description>You shouldn&#039;t need UriTemplate. I was trying to use it to format a query string but all i need to do was this:

&lt;code&gt;
[OperationContract]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,
           Method = &quot;GET&quot;,
           RequestFormat = WebMessageFormat.Json,
           ResponseFormat = WebMessageFormat.Json)]
        Result RecordMetric(int learnerId, string metricId, decimal value);

&lt;/code&gt;

I can then call my service like this:

http://myserver:someport/service/RecordMetric?learnerId=1&amp;metricId=123&amp;value=40</description>
		<content:encoded><![CDATA[<p>You shouldn&#8217;t need UriTemplate. I was trying to use it to format a query string but all i need to do was this:</p>
<div class="codesnip-container" >[OperationContract]<br />
        [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest,<br />
           Method = "GET",<br />
           RequestFormat = WebMessageFormat.Json,<br />
           ResponseFormat = WebMessageFormat.Json)]<br />
        Result RecordMetric(int learnerId, string metricId, decimal value);</div>
<p>I can then call my service like this:</p>
<p><a href="http://myserver:someport/service/RecordMetric?learnerId=1&amp;metricId=123&amp;value=40" rel="nofollow">http://myserver:someport/service/RecordMetric?learnerId=1&amp;metricId=123&amp;value=40</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AllanC</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-2070</link>
		<dc:creator>AllanC</dc:creator>
		<pubDate>Wed, 08 Jul 2009 23:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-2070</guid>
		<description>Thanks! This gave me enough pieces to get my SOAP and REST working together. Too bad that you cannot use UriTemplate and JSON (web scripting) together (it violates some WCF constraint).</description>
		<content:encoded><![CDATA[<p>Thanks! This gave me enough pieces to get my SOAP and REST working together. Too bad that you cannot use UriTemplate and JSON (web scripting) together (it violates some WCF constraint).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-1499</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 01 Apr 2009 02:23:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-1499</guid>
		<description>Thanks Cheeso and your reply, I copied the server&#039;s program.cs code onto the blog. My bad.

Content type negotiation is a very good idea, I&#039;ve seen an example of it from Codeplex.  However, one important issue with it is users are not able to modify http header field easily in the web browsers. In contrast, by expressing it at the endpoint level, you can easily control what kind of message you expect in the response by jsut altering the URL.</description>
		<content:encoded><![CDATA[<p>Thanks Cheeso and your reply, I copied the server&#8217;s program.cs code onto the blog. My bad.</p>
<p>Content type negotiation is a very good idea, I&#8217;ve seen an example of it from Codeplex.  However, one important issue with it is users are not able to modify http header field easily in the web browsers. In contrast, by expressing it at the endpoint level, you can easily control what kind of message you expect in the response by jsut altering the URL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cheeso</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-1495</link>
		<dc:creator>Cheeso</dc:creator>
		<pubDate>Tue, 31 Mar 2009 21:43:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-1495</guid>
		<description>Very interesting and useful. 

one problem? The client program.cs seems to be wrong - you actually show the server program.cs. 

Also, one question: what about content negotiation?  Rather than exposing different content types for the same resource at different URIs, why not have a single URI, and then allow the content type (json, pox, more?) to be negotiated at request time.  HTTP allows this. 

Of course if you are using WsTcpBinding then you don&#039;t have the content type negotiation of HTTP, but I suppose you could default to SOAP in that case.</description>
		<content:encoded><![CDATA[<p>Very interesting and useful. </p>
<p>one problem? The client program.cs seems to be wrong &#8211; you actually show the server program.cs. </p>
<p>Also, one question: what about content negotiation?  Rather than exposing different content types for the same resource at different URIs, why not have a single URI, and then allow the content type (json, pox, more?) to be negotiated at request time.  HTTP allows this. </p>
<p>Of course if you are using WsTcpBinding then you don&#8217;t have the content type negotiation of HTTP, but I suppose you could default to SOAP in that case.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nestor</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-304</link>
		<dc:creator>Nestor</dc:creator>
		<pubDate>Tue, 20 Jan 2009 16:15:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-304</guid>
		<description>Very nice post, self explanatory and easy to follow and understand.
Exactly what I was looking for about this possibility within WCF.

Thanks heaps, much appreciated.

Keep up your good posting.

Nestor.</description>
		<content:encoded><![CDATA[<p>Very nice post, self explanatory and easy to follow and understand.<br />
Exactly what I was looking for about this possibility within WCF.</p>
<p>Thanks heaps, much appreciated.</p>
<p>Keep up your good posting.</p>
<p>Nestor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-142</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 05 Dec 2008 16:25:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-142</guid>
		<description>Great post and examples.  Really appreciate it!

-Steve</description>
		<content:encoded><![CDATA[<p>Great post and examples.  Really appreciate it!</p>
<p>-Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-84</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 26 Oct 2008 09:15:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-84</guid>
		<description>Thanks for pointing out the typo. I have changed the &#039;pox&#039; to &#039;json&#039;</description>
		<content:encoded><![CDATA[<p>Thanks for pointing out the typo. I have changed the &#8216;pox&#8217; to &#8216;json&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html/comment-page-1#comment-78</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 24 Oct 2008 15:25:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemeit.com/?p=145#comment-78</guid>
		<description>Great post, thanks!

I was able to setup my own service to do these three formats all at once based on this.  Noticed a typo in your post though, when you&#039;re talking about the JSON request, the GET request should be:

&lt;code&gt;
// REST request with parameters in the URL
GET /TestService/json/GetFoo?name=wall-e&amp;age=256&amp;numberOfFoo=2 HTTP/1.1
Content-Type: application/xml; charset=utf-8
Host: localhost:81
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Great post, thanks!</p>
<p>I was able to setup my own service to do these three formats all at once based on this.  Noticed a typo in your post though, when you&#8217;re talking about the JSON request, the GET request should be:</p>
<div class="codesnip-container" >// REST request with parameters in the URL<br />
GET /TestService/json/GetFoo?name=wall-e&amp;age=256&amp;numberOfFoo=2 HTTP/1.1<br />
Content-Type: application/xml; charset=utf-8<br />
Host: localhost:81</div>
]]></content:encoded>
	</item>
</channel>
</rss>
