Over a million developers have joined DZone.

WCF and CoffeeScript, Who Says That Opposites Don't Attract?

· Web Dev Zone

Make the transition to Node.js if you are a Java, PHP, Rails or .NET developer with these resources to help jumpstart your Node.js knowledge plus pick up some development tips.  Brought to you in partnership with IBM.

At first look Wcf and CoffeeScript are very different: Wcf is chatty on the config side and bloated on the wire. CoffeeScript is just a "little language".

Look at this:
wcf = require 'wcf.js'
fs = require 'fs'

binding = new wcf.WSHttpBinding
	SecurityMode: "Message"
	MessageClientCredentialType: "Certificate"	
	MessageEncoding: "Mtom"

proxy = new wcf.Proxy binding, "http://localhost:7171/Service/"
proxy.ClientCredentials.ClientCertificate.Certificate = 

message = "<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>
                <Header />
                    <GetData xmlns='http://tempuri.org/'>

proxy.send message, "http://tempuri.org/IService/GetData", 
		    (message, ctx) -> console.log ctx
So while Wcf still can't make coffee, CoffeeScript sure does make these fine custom bindings!

This magic is done via Wcf.js, the first ws-* implementation for Node.js. Wcf.js is written in pure coffeescript javascript. What's next, will Microsoft build a tablet?

Learn why developers are gravitating towards Node and its ability to retain and leverage the skills of JavaScript developers and the ability to deliver projects faster than other languages can.  Brought to you in partnership with IBM.


Published at DZone with permission of Yaron Naveh, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}