Tuesday, April 7, 2015

Using a SOAP service as DLL


By default, when you do an Add Service Reference operation, the WCF runtime will generate the client-side proxy for you.

The simplest way to use it is to instantiate the client proxy with a constructor that takes no parameters, and just grab the info from the app.config:
YourServiceClient proxy = new YourServiceClient();
This requires the config file to have a <client> entry with your service contract - if not, you'll get the error you have.
But the client side proxy class generated by the WCF runtime also has additional constructors - one takes an endpoint address and a binding, for instance:
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport; 
EndpointAddress epa = new EndpointAddress("http://example.com/api/?wsdl");
YourServiceClient proxy = new YourServiceClient(binding, epa);
With this setup, no config file at all is needed - you're defining everything in code. Of course, you can also set just about any other properties of your binding and/or endpoint here in code.

NodeJs Quick File Server


Installation
$ npm install finalhandler

API
var finalhandler = require(‘finalhandler’);

Example
var http = require('http');
var finalhandler = require('finalhandler');

var serveStatic = require('serve-static');
var serve = serveStatic("./");
var server = http.createServer(function(req, res){
var done = finalhandler(req, res)
serve(req, res, done)
});

server.listen(8000);

API Details