November 08, 2018

What the shit is WCF?

I've been a long time user of ASMX. It worked so easily. Fire up a web service project in VS, implement some function. It's done. Share the WSDL to someone. They create a client. Test. Job completed. Now I'm having to learn WCF because some signing features are needed. Do the same thing with WCF. Well it works... but everything is different. All these new terms. It's no longer web service, its service. Also bindings and endpoints, contracts, URIs and Metadata. So here's my task. I've a WSDL file. I need a web service following that WSDL that signs it's messages and validates the client. So far, I've gotten svcutil to generate the code - in VB.

svcutil /sc "MyWSDLFile].wsdl" /language:vb
This generated a vb file. Containing an interface and some data classes. Next I created a WCF Service Library and added the vb.file. I added a new vb class that implements the interface of the vb.file.
Public Class MyClassImpl Implements MyServiceSoap
Great. Now test and it works in the WCF Test client. Oh I skipped over 2 days of trouble shooting. Also you have to edit the app.config file to modify the service details. Now to get it hosted on IIS. Ok what you gotta go is create an SVC file. This is a text file. It has no template in VS which is crazy. Anyway. Create a text file, call it Something.svc. Only 1 line in the file.
<%@ ServiceHost Service="[Namespace].MyClassImpl" %>
Browse it and you got the service up and ready to be tested. That took a long time. Now to get signing working.