REST, WCF 4, Forms Authentication, and Custom Clients (Part 2 of 3)

by Jason Williams31. December 2011 23:31

In the first part of this post, I discussed REST and how it compares to SOAP-based services. In this part, we’ll figure out how to create a REST service with WCF and what it takes to start thinking in a “RESTful” way when designing a REST service.

More...

Tags: ,

Development | REST | WCF

REST, WCF 4, Forms Authentication, and Custom Clients (Part 1 of 3)

by Jason Williams29. December 2011 00:09

SOAP and REST Compared

REST services are the new “hotness.” All of the cool kids are doing them. I (not that cool of a kid) feel as though I’ve been left behind -- holding onto my SOAP messages like an old curmudgeon holding on to his last dollar. After all, SOAP-based services have served me well; all the way back to the .ASMX days. So, I’m the first to admit that traditional (SOAP-based) web services still have a place. They are extraordinarily easy to use, nowadays, because the tooling around them is so polished. On top of that, I can’t think of a platform that doesn’t support them, today.

More...

Tags: , ,

Development | WCF | REST

A Web Server In Less Than 100 Lines of Code

by jason30. April 2009 15:52

Last night at the Lincoln .NET User’s Group, we had our second laptop meeting. A few people brought some code, a dev tip, or a fully working program to demo. I choose to show my "100 Line Web Server" I created to perform some unit testing on an app that was HTTP-centric, lately.

So, here is the entire program. I hope it’s useful to some and at least interesting to most.

Program.cs:

More...

Tags: , , ,

Development | WCF

Consuming JSON Services Without AJAX

by jason15. December 2008 23:59

JavaScript Object Notation (JSON) is one of the technologies used by AJAX and other "Web 2.0" technologies. It is a way to communicate in an object-oriented fashion between the web server and a client-side, JavaScript-based application. Every now and again, you might find yourself in a situation where you would need to consume a JSON service, but without a JavaScript endpoint. I ran into this situation when I needed to talk to an application that exposed a web interface, but has no other API hook. My mind first jumped to "screen scraping" the web pages in the exposed web interface. However, when I started to dive into the HTML, I found a very rich JSON service behind those pages.

An example message that I saw coming back from the application looked like this:

{"build":12639,"label": [
["done",8]
]
,"torrents": [
["74C61EB07A63ED2CBC84B8ECCFF85B1222A8006E",136,"myfile.iso",366779378],
["B28240047FD6C6A7219663AA862B2F1F4DD8AE24",136,"yourfile.iso",366784662]]
,"torrentc": "884739139"}

Examining the message, you'll notice that it seems to be broken into key-value pairs. For instance, the variable named "build" has a value of 12639. More complex object shapes can be represented by arrays like the value of the "label" variable. The above message could be represented in the C# class below:

More...

Tags: , , ,

Development | WCF

About

Jason Williams is a .NET developer in Lincoln, Nebraska.

The name "Centrolutions" came out of a long search for a domain name. The goal was to create a name that conveyed an ideology of writing software centered (Centr--) on a solution (--olutions) for a particular problem. In other words, it was the only name in a long list that wasn't already registered on the internet.

If you're looking for the products I have for sale, you should go here.