hen it comes to app server platforms, people canand dodebate endlessly about which is the best for running enterprise-class applications. Is it the Microsoft .NET platform? Or one of many application servers that implement the J2EE specification, such as BEA WebLogic 8.1? Each camp has unique advantages, but, as run-time platforms, features and performance are only part of the picture. To make a wise, strategic decision, a software team needs to consider other factors as well.
Chief among these is ease of development and deployment. Microsoft has always dominated this category; Visual Studio and Visual Studio.NET are widely used toolsand with good reason. They provide a very low learning curve and brilliantly abstract away the complexities of deployment and debugging. With Visual Studio even junior developers can start building enterprise-class applications without fretting over infrastructure issues.
Recently the development tools in the Java/J2EE space have begun to catch up. In particular BEA WebLogic Workshop 8.1 approaches Visual Studio.NET in terms of simplicityand may even surpass it. Eclipse is also popularand extremely powerfulbut has a high learning curve. Sun's Java Studio Creator (nee Project Rave) is showing some exciting potential too.
Mainsoft has thrown its hat into the ring with a revolutionary approach. Its product, Visual MainWin, gives the best of both worlds. Using Microsoft Visual Studio.NET and C#, you can build, deploy, and even debug applications on a variety of J2EE application servers. Yes, that is right: You can compile C# or VB.NET from VS.NET into java bytecode and run it on J2EE.
Currently Visual MainWin supports Tomcat, BEA WebLogic, and IBM WebSphere, with more to follow, most notably JBoss.
This original approach opens up some very interesting possibilities and offers companies unique platform flexibility. For example, if a company decides it isn't happy with the Microsoft.NET platform, it can move to J2EE without retraining developers, hiring new developers, or rewriting apps. C# and VB.NET developers can hit the ground running!
Installation and Starting New Projects
Installing Visual MainWin is very simple as everything is prepacked for you in an InstallShield installer. The wizard handles everything for you except for one thing: you have to tell it which application server you want to install this copy of Visual MainWin for. Be warned: If you want to develop for a different application server later you'll have to uninstall Visual MainWin and reinstall it.
|Figure 1. Picking an App Server: The installation dialog requires you to select which application server you want.|
Your application server must be up and running before you do this step, or Visual MainWin will not be able to configure itself. The available options are to install the version of Tomcat 5 that is bundled with the software, use an existing Tomcat 5.0 installation, IBM WebSphere 5.1, or BEA WebLogic 8.1. For this review I used WebLogic 8.1.
Visual MainWin runs entirely inside of Visual Studio. So, to launch it, simply launch Visual Studio.NET. When you do, you'll notice immediately that you have two new project types to choose from in the New Project dialog: C# for J2EE and VB for J2EE. For the purposes of this review I concentrated on C#, but a few simple applications written in VB.NET worked smoothly too.
The product is very tightly integrated with Visual Studio. To create a J2EE application, simply select File->New Project and pick the type of project that you want. As it does with traditional Microsoft applications, the New Project Wizard takes you through the intended solution type, abstracting the methodology for the solution type away from you.
Visual MainWin is designed from the ground up to be familiar to Microsoft developers in that you concentrate on the type of application that you want to build, not the type of infrastructure. For example, when you create a C# Web service, you are actually creating a DLL, but Visual Studio calls it an ASP.NET Web service and hides the plumbing from you. Visual MainWin does the same: It leads you to create (for example) a Web service, without making decisions about how the Web service is implemented on the underlying application server platform.
And because the paradigm for Visual MainWin follows the Microsoft one very closely, you will notice that the dialog does not give the option to create something that is J2EE or Java-specific such as an EJB. The underlying framework of your application is determined for you by Visual MainWin. For example, a Web application is implemented as an ASPX page, which compiles into a JSP under the hood. Mainsoft promise that future versions of the software will support EJB but how it will be supported is not yet clear.
Creating and deploying a Web service with Visual MainWin is just as simple as it is with Visual Studio.NET. If you are familiar with selecting the ASP.NET Web Services Wizard in the C# folder on the New Project Dialog, you will see that the process is almost identicalyou simply select the ASP.NET Web Services Wizard in the 'Visual MainWin C# for J2EE' folder. Following the Wizard will create the standard and familiar boilerplate Web service, which is exactly the same as the one that Visual Studio creates for C# users. It is a 'Hello, World' Web service, with a single Web method that echoes 'Hello World' back to the user. The Wizard comments this code out. I commented the code back in and started debugging. The application compiled, deployed to WebLogic, and ran.
Not everything was as solid as I'd hoped. Web services usually have a simple test harness that allows you to query their methods from a Web interface, but Visual MainWin has nothing but a simple screen telling you that the test page is not yet supported. It suggests that you query the WSDL by amending the URL with a ?wsdl at the end. This is an inconvenience, albeit a minor one.
|Figure 2. Pick a Project: To create J2EE projects in Visual Studio, simply select one of the two new project types added to the New Project dialog when you installed Visual MainWin.|
You can add this URL as a Web reference in Visual Studio.NET and consume it as you would any other Web service. This, too, worked seamlessly.
Here's another problem I noticed: If you create a Web service in C# and deploy it to WebLogic, and then attempt to consume it within a WebLogic Workshop environment by creating a WebLogic control from the WSDL, it fails. WebLogic doesn't recognize the WSDL. While this isn't a typical use of Visual MainWin, it does hinder a potentially useful use casethat of orchestrating Web services in a WebLogic process project.
I also tried to consume the WSDL with the Oracle JDeveloper stub/skeleton wizard, and it, too, failed to consume it. Microsoft Visual Studio, however, has no problem consuming the WSDL to create a Web service stub.
It seems that Web Services created using Visual MainWin are easily consumed by Microsoft .NET Clients, but not so easily consumed by Java-based clients.
The online documentation is very good and contains a number of detailed examples of large-scale applications that can be built using Visual MainWin. Some simpler, smaller scale examples would be useful as well, but what is there allows you to see the entire scope of the application. While Visual MainWin is not capable of generating EJBs, it is capable of consuming them, and examples of this are shown.
While generating EJBs may seem to be important functionality missing from the product, in fact, Visual MainWin is not designed to be used by senior architectsthe people who build the frameworks on which your applications run and who can dream in EJB. But if these senior architects drive infrastructure in the direction of EJB, the development support team must follow suit. By leveraging Visual Studio's ease of use, Visual MainWin delivers the ability for supporting developers to keep pace with the architectural vision, whatever that is and levels the playing field for Java in terms of complexity. The philosophy is that elite developers will continue to develop in what they see fit to use, and the lower-end developers will have this tool to make their work easier.
When it comes to database support, if your database is Microsoft SQL Server or Oracle, then your ADO.NET code will work without modification. If, however, you use any other database (for example MySQL or DB2), the process is a little more complex. Namely you have to import the JAR file for the JDBC drivers and explicitly use it and the relevant java.sql files to access the data. You end up effectively writing Java code in the C# environment. This isn't as difficult as it sounds, but does negate some of the advantages of the platform.
Visual MainWin is an excellent and revolutionary product. While it has its flaws, they are relatively minor and most of them will be addressed in future versions according Mainsoft. For any company that wants to provide its services on Microsoft and J2EE-based platforms, it could provide a massive cost-savings. Having code that can run on both platforms and be debugged on both platforms is an enormous luxury. At $5,000 per workstation it may seem expensive, but a week's worth of training for developers could easily cost as much.
If your developers are experienced in C# and you want the option of using J2EE application servers, Visual MainWin is uniquely qualified to help you. Don't expect it to handle all of your code transparently, though. It should allow the majority of your code to run on a J2EE application server, which in itself is a major boon. Should Mainsoft continue to evolve the platform, widening its support for application servers, databases, and functionality the product will become a must-have for everybody.
|Editor's Note: Laurence Moroney is currently the Director of Product Evangelism at Mainsoft; however, he wrote this article for DevX before joining Mainsoft.