views:

73

answers:

1

I have a WCF service that has webHttpBinding and has enableWebScript turned on in it's endpoint behavior configuration.

The response from the service looks something like this

HTTP/1.1 200 OK Date: Fri, 23 Oct 2009 20:09:02 GMT Server: Microsoft-IIS/6.0 X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: application/json; charset=utf-8 Content-Length: 25

{"d":{"__type":"SOMETYPE", ... }}

Its using HTTP 1.1 and so there are the standard headers. The contentType is set to be applciation/json which also makes sense. In the message body (the JSON part), everything is enclosed in an envelope titled "d".

What is that? Who defines that protocol? Is it something specific to WCF?

I couldn't find that defined in any of the protocols involved or the definition of the "application/json" contentType.

Thanks

+2  A: 

That is ASP.NET AJAX specific and is caused by applying the WebScriptEnablingBehavior (enableWebScript in config) to your endpoint. The wrapper is required on both input and output and there are also special behaviors added around exception handling.

If you want "pure" JSON, you should remove the WebScriptEnablingBehavior and just use WebHttpBehavior (webHttp in config). Then just make sure you explicitly set the Request/ResponseFormat properties on your WebGet/InvokeAttributes.

Drew Marsh