Tridion implements the Core Service using WCF 3.5 and this is the suggested interface to use for accessing the Tridion API outside of the Event System or Templates. Although I have heard horror stories of the configuration options and how difficult WCF is to work with, so far I did not have such experiences using the Core Service with ‘Add Service Reference’ in Tridion and then doing simple things. Today was different.
Today I tried making a small Console application using the config-less Core Service code from Jaime Santos’s post about the Data Extenders. This brought me into touch with the various bindings and security aspects – and I had a new respect and fear of WCF that I had not known before. Jaime uses the tcp binding and I understand this is the best performing binding. However, my Tridion Server declined the connection for TCP and I assume the port is blocked. Then, I tried modifying his code to use an HTTP Binding – but many of the options he uses are TCP only and I was quickly making a mess of the code. For some strange reason I tried using a WSHTTP binging – but that wants me to use https and the Tridion WCF Core Service does not accept it (or maybe my web server is not configured for it?). By this time I took another look at the Config-less Core Service Example from Puf and found new inspiration for making this work. His example requires a password for the account while the TCP example did not. I wonder why this is? I borrowed Puf’s code and adapted it to take advantage of some of Jaime’s ideas in his Handler. During the process I learned that the TCP binding is much better performing and we need to explicitly open and close the connections - the cost of opening a connection is very high.
Jaime uses the Core Service in a Data Extender where performance is extremely important, so I understand why Jaime choses the TCP binding over HTTP.
In the end I have a small Console app that calls the Core Service using a BasicHttp binding. It gives us an easy way to get started testing Core Service code that later might end up in a GUI Extension or Import app.
Get the Code at https://github.com/rcurlette/TridionCoreServiceConsole