Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Free Your C# Apps from .NET Platforms

Visual MainWin offers unprecedented platform flexibility, allowing you to develop applications in C# and deploy and run them on J2EE. Learn how to take advantage of this freedom by building a C# Web service that you can run on platforms besides .NET and IIS.


advertisement
ainsoft's Visual MainWin is a revolutionary product that allows you to develop applications in C# and deploy and run them on J2EE application servers (for a detailed review, click here). Using this flexiblity, in conjunction with the simplicity of Web services development provided by Visual Studio.NET, you can finally create applications and Web services that run on platforms other than IIS and .NET.

Getting Started
If you don't have a copy of the application, you can register for a 30-day evaluation copy from Mainsoft. To understand and follow the rest of this article, you will need a copy of Visual Studio.NET 2003 and a copy of Visual MainWin installed and running. Note that when you are installing Visual MainWin, please select the 'Bundled Tomcat 5.0' application server. If you are more comfortable working in BEA Weblogic 8.1 or IBM Websphere 5, you can also use these with MainWin—simply select them when you install. Some of the URL references in the article will be different if you are using one of these products (for example: Weblogic runs on port 7001, so references in this article to port 8080 should be changed to 7001).

First, start your application server. The new project dialog box in Visual Studio doesn't automatically start it up, and it will throw an error if the application server isn't running. Do this by going to your Start Menu and selecting 'Start Tomcat' in the Visual MainWin program group. Once Tomcat has started you can launch Visual Studio.NET and you are ready to proceed.



In Visual Studio.NET, select the 'New Project' wizard, and you will immediately notice some changes to the dialog.

Figure 1. This is the New Project Dialog.

Figure 1 shows some of these changes. Two new project type folders have been added, giving projects in C# and VB for J2EE. Also, the location for Web applications is now localhost:8080 instead of the familiar localhost. This is because Tomcat runs on this port by default. If you had selected Weblogic 8.1 when installing Visual MainWin this would read 'localhost:7001.'

Select ASP.NET Web service, as in Figure 1, but change the name to DevxMainWin and click OK. The Visual Studio wizard creates the Web service for you.

If you have used Visual Studio to create Web services before, this will look immediately familiar. It's a 'Hello World' Web service with a single Web method, called HelloWorld(). The method will be commented out, so comment it back in so that your code will resemble that in Figure 2.

Figure 2. Visual Studio.NET creates a default Web Service.

Compile and run this application to see the first major difference with Visual MainWin. Instead of the familiar test harness, you get a simple screen that says:

Visual MainWin For J2EE: Test page is not yet supported. Add the string ?wsdl to the current URL to get the service description.

So, you can build and run the Web service, but you can't really tell if it does anything.




Editor's Note: Laurence Moroney is currently the Director of Product Evangelism at Mainsoft; however, he wrote this article for DevX before joining Mainsoft.




Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date