DZone
Web Dev Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Web Dev Zone > WCF and CoffeeScript, Who Says That Opposites Don't Attract?

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

Yaron Naveh user avatar by
Yaron Naveh
·
Jun. 23, 12 · Web Dev Zone · Interview
Like (0)
Save
Tweet
4.73K Views

Join the DZone community and get the full member experience.

Join For Free
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 = 
	fs.readFileSync("client.pem").toString()

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

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?

Windows Communication Foundation Coffeescript

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

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Flutter vs React Native. How to Cover All Mobile Platforms in 2022 With No Hassle
  • How to Handle Early Startup Technical Debt (Or Just Avoid it Entirely)
  • Upload Files to AWS S3 in JMeter Using Groovy
  • ERP Integration Guide | Common Scenarios, Challenges, and Methods

Comments

Web Dev Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo