Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

XFire: The easy and simple way to develop Web services

Expose your POJO methods as Web services

  • Print
  • Feedback

Page 5 of 6

To try with different input values, you could also use a full URL like this: http://localhost:8080/websvc/ws?from=11-2345&to=77-9876&amt=250.00&cur=EUR.

Basic Web services development checklist

This checklist summarizes the steps required to expose a Java method as Web service:

  1. Check that the Java class's method and the default constructor are public
  2. Add XFire servlet-related entries to web.xml
  3. Create services.xml and put it under the WEB-INF/classes/META-INF/xfire directory
  4. Add the XFire and third-party libraries into your Web application's WEB-INF/lib directory

That's all that's needed. Yes, it's that simple.

Other advanced features of XFire

XFire may be simple to use, but in terms of features and functionalities, it is at the leading edge. Some of its advanced features are:

  • Native data binding support for plain-old Java objects (POJOs), XMLBeans, Java Architecture for XML Binding (JAXB), Castor, etc. Data binding specifies how the XML requests coming to the Web service and the XML responses going out are mapped to Java objects.
  • Use of the Streaming API for XML (StAX) to process XML documents. In contrast with the Document Object Model's tree-based approach and the Simple API for XML's event-driven approach, StAX uses a pull-based mechanism, which makes it much faster and more memory-efficient.
  • Support for various transport protocols such as HTTP, Java Message Service, and in-JVM transport.
  • Embeddability, which is one of XFire's core strengths. You can embed this SOAP engine into your application and completely hide all XFire-specific references, as all configurations are program-driven.
  • Rich API, which makes it highly customizable and allows developers to intercept requests at various stages and handle them as required.
  • Compliance with latest standards such as SOAP 1.1 (no encoded remote procedure call, or RPC) and 1.2, WSDL 1.1, the Web Services Interoperability Organization's Basic Profile 1.0, Web Services Addressing, and WS-Security.


Most importantly, XFire belongs to a new generation of Web services engines. Not just a marketing phrase, "new generation" has some significance. Apache Axis was one of the first Web services engines in Java and became a benchmark for all tools that came later. Axis and these other tools have been field-tested in many production environments over the last few years. One of the key lessons learned is that Web services are not best suited for RPC-style communications. For performance and efficiency, document-oriented messaging-style is the way to go. But Apache Axis and most other Web services engines are, by design, RPC-oriented (although they support the document style). The industry is now in the process of developing a new generation of SOAP engines, which are, by design, document-oriented. Apache has already announced the end of development for the old Axis engine and is now working on Axis2, which is now on its prerelease version of 0.95. XFire had its first production release (1.0) in February this year. Its next release (1.1) is slated to be available in just a few weeks.

  • Print
  • Feedback

Resources