Pages

Saturday, December 18, 2010

HTML5 Editors

HTML5
When something new comes along, the old has to give away. Do you believe so? HTML5 is evolving and is already well supported by most of the smart phones and leading browsers. Ipad/IPhone enabled websites are all powered with HTML5. With increasing usage of Smart Phones, there is a compulsory need for every website to have a mobile friendly version. With the promising features like Offline support, enhanced multimedia, graphics, interactive Drag & Drop and advanced UI forms, HTML5 will eventually become the standard of the web.



Editors for HTML5:
The specification for this major version of HTML is not finalized yet. Probably because of this reason, there are not much HTML5 editors available for developers. Till HTML4, W3C would finalize the specification first and then the browsers and editors would start to implement them. With Google and Apple heavily backing up HTML5, browsers have started implementing the draft version of HTML5 and kept moving forward on their browse race. Developers are left with only a few options to choose their favorite editor for HTML5. The editors available on markets like Dreamweaver CS5, Aloha Editor (WYSIWYG based) are licensed and heavily priced. Web developers are forced to use Text Editors like Textpad, Editplus, Notepad++ or Eclipse IDE without any additional help for quick reference.



Eclipse & HTML5:
With the support of third party plug-in like Aptana Studio 3.0 beta, Eclipse (Version 3.4 or above) is able to provide HTML5 support for developers to some extent. The good thing about this plug-in is that, it supports code assistant for JQuery (Version 1.4.2). For web developers, this is a great boon, I would bet. The code assistant tool recognizes HTML4 tags well but eclipse will flag a compilation error for new HTML5 tags. Even the latest version of Eclipse 3.6 does not have a built in support of HTML5. Aptana has little support for CSS3 and built in Preview option for HTML files.. To install the plugin,


Netbeans & HTML5:
Netbeans.org has recently released their Beta version of IDE 7.0 with HTML5, Javascript, CSS, AJAX, JSON and JavaFX formatting support. The interesting feature about this release is that the code assistant tool is able to identify most of the HTML5 tags supported by leading browsers like Chrome, Firefox, Opera and Safari. The code assistant tool briefs the HTML5 tag syntax, attributes and the browsers that currently support the tag. It also shows example code with appropriate syntax and suggestions. The code assistant works out well for Javascript and CSS files as well but there is no support for JQuery. It also has an option to view the HTML5 specification (draft specification as of September 2010) in a separate browser. There is no need to update or install plug-ins for HTML5 support on it.












It would be great if we have the power of Aptana on Netbeans. But they themselves are competitors on Ruby and PHP front. We have to wait for Aptana Studio to fully support HTML5 or Netbeans to support JQuery. When something new comes along, it doesn’t mean that the old has to fail. They can live in harmony with one another and generate greater results. Agree?

Tuesday, December 7, 2010

Web Services - An Introduction

Hello there,
This article is for the beginners and people who are new to Web Services. I have compiled the things you need to know when you get started with Web Service. Screenshots are available in the attached document.

Web Services Introduction:
Web Services help in exposing the available services in your application to the Web thereby making your application a web application. With web services exchange of data between different applications on different platforms becomes simple. Web Services are application components that communicate using XML + HTTP. Web Services use XML to encode and decode data. It uses SOAP to transport the data.

It is composed of three elements
• SOAP – Simple Object Access Protocol (Platform independent, XML Based)
• UDDI – Universal Description, Discovery and Integration
• WSDL – Web Services Description Language

SOAP – Platform independent, XML based protocol for accessing a web service.
UDDI - A directory service where companies can register and search for Web services.
WSDL - XML based language that describes Web Services message formats and protocols.

Creating Web Services:
Web Services can be created in two ways.
• Top Down Approach (WSDL  Coding)
• Bottom Up Approach (Coding  WSDL)

Top down Approach:
In this method, the WSDL is created first using the WSDL editor. The web service wizard on eclipse can be used to create skeleton Java Classes and the desired implementation can be done on or based out of those classes. Creating the WSDL first gives more control over the web service and hence this is the recommended way of implementing a web service.

Bottom up Approach:
In this method, the desired implementation is done through coding and the service class (Java Bean or EJB) is exposed as Web Service. Web Service wizard in eclipse can help in creating the WSDL file and web service configurations corresponding to the Service class that is exposed. This method is easier and faster and used by developers who are new to Web Service.


IDE / JDK requirement:
  1. Get Eclipse 3.2 or above.
  2. Install JDK 1.4 or above.
  3. Install Tomcat 5.5 or above.
The example project here uses Eclipse 36 (Helios, Java EE IDE for Web Developers), JDK 1.6 and Tomcat 6.0.1.2

Getting Started with Web Service:
Let’s build a web service that accepts a name and says Hello. i.e. If you pass “John”, the web service will return a string “Hello John” as response. The method exposed to web here is “sayHello”.
Top Down Approach:

Create a Workspace with a dynamic web project (2.5).
Copy axis.jar, saaj.jar, jaxrpc.jar to the lib folder of WEB-INF.
Create a folder named “wsdl” inside your WEB-INF. Copy/Paste your wsdl file to that.






















Right Click on the WSDL file (Hello.wsdl), Select Web Services and Create Java Bean Skeleton.






















Web Service Wizard will pop up. Carefully note down the text fields and values. Do not change anything here. Click Next.



































Click Next



































Now your Java Bean classes are created. Click on Start Server. This will add the Web Project (Hello_Web) to the Tomcat server and start the server. You can also see the Web Service Descriptor files created inside Web Project (deploy.wsdd and undeploy.wsdd).





















Bottom Up Approach:

Create a new dynamic web project (Hello_WebWS) .
Copy axis.jar, saaj.jar, jaxrpc.jar to the lib folder inside WEB-INF.
Create a Java Class (com.webservice.sample.Hello.java) with a public method with signature “public String sayHello (String name)”. Let the method return the string “Hello + name”.






















Right Click on Hello.java Web Services Create Web Service






















Web Service Wizard will show up with Web Service type as “Bottom Up” Approach. No changes here. Click Next.


































All your public methods in Hello.java should come here. Select the methods you want to be exposed as Web Service. Click Next.


































You do not want to publish your web service now. So, click finish button here.
Your WSDL file, Web Service Descriptors (deploy.wsdd, undeploy.wsdd) are created on Web Project, and web project added to server and should be in STARTED status now.



Testing Web Services:
Testing the web service is easy and is same for both the development approaches. Right click on the WSDL, Select Test with Web Services Explorer.



































Click on the sayHello method. It will show a text field to accept the input (name). Type in “John” and click on GO. You will see the response printed on the explorer.





















Hope it helps... :)