JsonValue viewer

One more nice tool for the JsonValue API: a WPF control which can be used to view JsonValue graphs. It’s a simple control which inherits from TreeView and shows the graph in a tree-like fashion. This following JSON document, for example, is shown in the picture below. [1,2,true,”hello world”,null,{“one”:1,”two”:2,”bool”:true,”str”:”Hello world”,”array”:[null,{},true,false]}]                     JsonValueViewer The viewer uses…

0

Deep event propagation in JsonValue

One of the features added in the latest release of the WCF for jQuery support in Codeplex was the ability for a user to register to listen to modifications in a JsonValue instance. However, if you have a JSON DOM and you want to be notified for changes in any member of the graph, you’d…

0

System.Json improvements

Yesterday the WCF team released a new version of the “WCF Support for jQuery” libraries on codeplex (http://wcf.codeplex.com). Besides some bug fixes, we added some new features to make the JSON API better. Here’s a short list of them: Events Similarly to the XElement API, JsonValue now supports events as well, so that a user…

2

JsonValue pretty printing

Now that the System.Json API has been released (http://wcf.codeplex.com, http://wcf.codeplex.com/wikipage?title=WCF%20jQuery), I’ll start posting a series of “improvements” that I’ve done over the past few months using that library. Let me know if you find it useful, and I’ll bring it to the team to include in future releases of the Codeplex project. To start, something…

0

Working with untyped JSON in a WCF service

Since NetFX 3.5, WCF has support for working with JSON data. You can define your data contracts according to the JSON “schema” you expect to receive / want to return, plug them into your operation contracts, and your server is talking JSON. With this feature you can define the contract such as: public class Person…

6

DataContractJsonSerializer and the “unexpected namespace” error

I’ve seen this error pop up in the forum enough times that I think it’s worth a blog post. JSON (www.json.org) is a very simple data format, and, unlike XML, doesn’t have the concept of namespaces – all it knows about are primitive types (strings, booleans, numbers), sequences (arrays) and records (objects). So it’s strange…

2

Using relative addresses for services in Silverlight applications

One of the biggest complaints about how Add Service Reference works for Silverlight applications is that the address it creates on the client config file (ServiceReferences.ClientConfig) points to the VS “test” web service (Cassini), something like http://localhost:12345/Service1.svc. It works perfectly when you debug on your machine (F5), but when you deploy it elsewhere (e.g., http://www.my.server.com/MyApp)…

3

Enabling cross-domain calls for SL apps on self-hosted TCP services

On a post a couple of years back, I showed a solution to enable cross-domain calls for Silverlight apps on self-hosted WCF services. In Silverlight 4, we added a new transport (net.tcp), which needs its own policy file as well (see more details at http://blogs.msdn.com/b/silverlightws/archive/2010/04/09/policy-file-for-nettcp.aspx). If you are running IIS (or some other web service)…

21

Using TransferMode.StreamedResponse to download files in Silverlight 4

After seeing some questions about this new feature added in Silverlight 4, I decided to post an example to see how it can be used in some real world scenarios. This new mode was added mostly to enable the performance improvements in the Polling Duplex protocol, but it can also be used by itself, such…

16

Changing prefixes in XML responses for WCF services

When responding to requests using any of the text/XML bindings (BasicHttpBinding / WSHttpBinding / CustomBinding with a TextMessageEncodingBindingElement), WCF has some specific prefixes which it uses corresponding to a certain namespaces. The SOAP namespace (“http://www.w3.org/2003/05/soap-envelope” for SOAP 1.2, “http://schemas.xmlsoap.org/soap/envelope/” for SOAP 1.1), for example, is always mapped to the prefix “s”. This is usually not…

7