Featured Whitepapers
Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

XFire: The easy and simple way to develop Web services

Expose your POJO methods as Web services

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Web services enable us to build distributed systems where application components on a network can be accessed in a platform-neutral, language-agnostic, and implementation-independent way. It doesn't matter how an application is developed, what language it uses, or what OS platform it runs on. If it is available as a Web service and designed addressing interoperability issues, your application, developed in any language or platform, will be able to utilize its services. That's the main concept of Web services.

To achieve the platform-neutral and implementation-independent accessibility of Web services, the software industry has agreed on a few technologies as standards. Some of them are:

  • XML: The default data format used across all layers of Web services environment.
  • SOAP: The default protocol for packaging and exchanging messages. When first introduced, it was an acronym for Simple Object Access Protocol. But now SOAP is considered a proper noun, a name in itself, as most people now realize it is a misnomer: SOAP is not really for accessing objects. Plus, it is not simple any more.
  • WSDL (Web Services Description Language): The language that describes Web services. Although based on XML and understandable by humans, WSDL is mainly for machine consumption, to be read and understood by client programs.


The following high-level diagram, based on the document "Web Services Architecture" published by the World Wide Web Consortium, shows how all these technologies are engaged in a working environment:

The process showing how core technologies engage in Web services. Click on thumbnail to view full-size image.

Here, Provider is the application component that would provide the service, and Requester is the client program that would consume it. Many other technologies may participate in the interactions, but this figure shows the core components that must be in a Web services environment.

XFire is a free and open source SOAP framework that not only enables you to implement such an environment with great ease and simplicity, but also provides you many advanced features identified in Web services specifications, but not yet available in most commercial or open source tools. You read the words correctly: great ease and simplicity. In this article, you'll see how simple it is to build a Web service with XFire.

If your Web application has a Java class and you want its methods to be exposed as Web services, you may not have to write a single line of additional Java code when you use XFire. Just work on the deployment descriptors and you'll get a Web service. Yes, it's that easy. Let's look at an example.

A simple Java class

Our example is a banking application hosted in Apache Tomcat 5.5.7 and running under J2SE 1.4.2_07. I assume you already know how to write Web applications in Java and deploy onto Apache Tomcat servers. Our Web application is simple; it does just one thing—transfer funds from one account to another. A plain-old Java class BankingService containing a method named transferFunds() does the job for us. It needs four input parameters:

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (5)
Login
Forgot your account info?

Thanks for good and short article which helps to understand basiBy Anonymous on June 11, 2009, 6:42 amThanks for good and short article which helps to understand basic information.

Reply | Read entire comment

helpful!By Anonymous on May 14, 2009, 12:57 pmThanks for the great run-through, you are correct that xFire has a lot of work to do on their user guide. This was very helpful!

Reply | Read entire comment

great articleBy Anonymous on March 25, 2009, 6:47 amhi, It is a very short and clear artcle written by Shahid Ahmed, thanks for it. Can you please provide the simillar article on Apache Axis. Regards Jay

Reply | Read entire comment

here is a link: http://docs...By Anonymous on March 5, 2009, 9:37 amhere is a link: http://docs.codehaus.org/display/XFIRE/Download

Reply | Read entire comment

?????????By Anonymous on December 2, 2008, 3:58 pmwhere do i download xfire here

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources