WCF configuration editor not showing in VS2010 Workflow Service Project

I am creating a Workflow service project for WF 4.0 in VS2010.

When I right-click on my web.config, I am not seeing the “Edit WCF Configuration” option:

WCF config editor not visible


I realised that a work around for this issue is to launch the editor from the tools menu:

This seems to wake VS up, and once that has been done the option will show:

WCF config editor available


MySQL – A first look


I recently needed to produce a system for a client that owns a trading company. Now this is a fairly small business, but the data requirements were such that the database would easily grow above 4GB within year or two. So SQLExpress was out, as it is limited to 4GB. And the company is too small to afford the high fees of buying a full SQL Server.

The tools:

So I spotted the opportunity to learn a bit, and downloaded and installed MySQL 5.1. First impressions were really positive. It installed withut hassle, and I found a tool called MySQL Workbench on the same site, which looked like a good management tool.  I installed that too, and the program seemed OK to work with, I could design my tables etc. But then when I wanted to load those tables into a database I ran into some annoying limitations in the free version of MySQL workbench. Basically it is very clunky unless you buy the full version. Which I was not going to do for one little project.

Then I looked around and found Toad for MySQL. I was astounded. What an amazing product! It is completely free, and delivers an excellent user experience. You can write and run queries from it (with code completion!),  you can design tables in a really friendly table editor which allows you to commit entities to the database ot to get the DDL to create them yourself, you can create table diagrams etc. I was suitably impressed.

So what is it like?

Initial impressions were quite favourable. There are a few concepts that you have to learn while designing tables, like the storage engines. Basically MySQL allows you to specify a storage engine per table. The InnoDB engine is transactional and allows foreign key relationships etc. The MyISAM engine is non-transactional, does not allow keys but it is super quick. Useful for logging or, in my case, useful for storing huge numbers of stock price records. There is also an in-memory table which works like a SQL Server temporary table, except that the in-memory tables are still defined after a reboot, without any data content, while a temp table is gone after a restart.

It’s query language is full featured, and a little foray of mine into date processing left me with a very favourable experience – there is lots of support online, and the language is as powerful as TSQL, as relates to dates at least. It was stable and fast, and I would be quite happy putting any of my systems into production using MySQL. Of course I am stating the obvious here – many huge systems (including Google) run on MySQL, but it is still quite nice to have a look for yourself.

And what didn’t I like:

It does not seem to have Windows Authentication support, which is a bit annoying. The Entity Framework did not work with an out the box client install, although I did read that it works, there is just some additional installation necessary. It now does support stored procedures, but still not all the richness we have in SQL server like DDL triggers, user defined functions etc.

And the conclusion?

For systems not hugely database bound but rather with an intelligent middle tier and data layer, I would be very happy to use MySQL. I believe it would be as productive as using SQL Server, and it doesn’t cost a cent! What a pleasure.

What can we learn from design patterns?

I saw this article, where the author says that (and I’m paraphrasing here) he thinks that design patterns stifle creativity, and should not be used.

Which led me to the question: “In addition to learning design patterns by rote, and implementing them from memory in some twisted version of cut and paste, what can we learn from design patterns?”

Although I believe that there are many problems that should not be solved by forcing the problem domain into a pre-rolled solution, I also believe that design patterns do more good than harm.

I have always thought “What can I learn from this design pattern?” rather than “How can I force this piece of code to conform to this design pattern?”  I personally find that the way of thinking that I learnt from studying design patterns has helped me enormously to write code that follows the accepted best practices of object orientation,long before I even knew that such things existed. The practices that I am referring to are things like the open / closed principle, the law of Demeter, the Liskov substitution principle, the single responsibility principle etc.

My contention is that by studying design patterns, you learn to solve problems in ways that automatically conform to these and other best practices, and as such will be easier to create, maintain, unit test etc.

And, for many common programming problems, design patterns already represent an industry standard method of solving them. Things like singletons, factories, command and strategies are software components that everyone should be using to solve the issues that they are meant to solve.

So, by all means, don’t fall into the trap of blindly obeying someone else’s solution because it is some sort of best practice. But, equally and perhaps even more importantly, don’t discount the benefits to be had from the open-minded study and usage of design patterns.

Communicating between WCF services and J2EE

We started a new project this week at my day job, where we are creating a common set of services using WCF in .NET 3.5 SP1, and in addition to the .NET applications making use of them, we wanted some Java systems to communicate with them. The Java systems are an ESB running in Apache ServiceMix, and some other as yet undefined Java systems running on Solaris boxes.

We chose WCF for the ease of creating new web services, where it does all the heavy lifting for you and allows you to swap protocols and addresses transparently. We chose .NET 3.5 SP1 both because it is new and shiny, and because it offers the entity framework, and we like the entity framework.

But now we were faced with the question: How do we make the java code call the services? And indeed, since we are a bunch of java noobs, how do you call web services in java? We called on the great google, and it showed that apache axis seemed to be a popular tool to both publish and call web services with. So, deciding that who were we to argue,axis it was.

I created a default web service, ran it from the IDE, and pointed Axis at it to generate a stub from the WSDL with the WSDL2Java program included in the Axis distribution. The location of the WSDL is available from the test page that Visual Studio brings up when you run your service.

Oh-oh, no luck. The axis client complained of a problem with its understanding. I’ll reproduce it and post the exact error message here. When I googled that error message, I found a whole bunch of interesting pages, but nothing that helped me understand what the problem was.

Then I thought about it for a while and remembered that the WCF web services were supposed to ship with all the WS standards enabled, and reasoned that maybe Axis did not like these newfangled things, and wanted a simpler SOAP interface.

After a dead end or two, I realised that you can change the port mapping in the WCF config file to use a basicHTTPMapping, and that this then publishes the web service as an old style SOAP service, which Axis was happy to generate clients for.

I tested the clients, and hey presto! We could invoke the WCF web services from the Java code.

But, never being content to leave well enough alone, I decided that I wanted to remove the WCF webservices from the tempuri.org namespace, and put them in a more appropriate one. I added namespace information to the service by modifying the service  interface, the service implementation and the binding namespace in the web.config file.

These are the things I changed:

Then I attempted to regenerate the clients with the axis tool, and it complained. The error message was about invalid WSDL structure. After thinking on this for a bit, and comparing the original tempuri.org namespaces in the WSDL to my new ones, I realised that axis was expecting certain relationships between the namespaces on the three attributes, and then I realised that the namespace in each of the three places mentioned above must be EXACTLY the same.

I changed them all to be identical, and there it was. The client stubs generated correctly, and they were able to successfully invoke the services.

As our good friend Borat says so wonderfully “great success!”

I have arrived!

Ok, so I have finally gotten so far as to start a blog. Hopefully we can have some interesting and illuminating discussions on all things related to programming.

I decided that I would start one so that I can post things as I learn them (I have some interesting ones stored up), so let’s see where this takes us, hmmm? And besides, all the cool kids are doing it!