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 6 of 6

Performance

Web services consume many resources, but they are not known to be attractive in terms of performance. XFire breaks that trend. It consumes significantly less memory (in part because of the use of StAX), but performs much better than most comparable SOAP engines. You can see a few comparative results in the links provided in Resources.

Additionally, XFire also provides ways to optimize performance further. One such approach uses the in-JVM transport. If you know that the Web service is running in the same JVM as the client, you could choose to use a local transport that would make your services scream. In the example's client code, look at the line where the service endpoint URL is specified:

       String serviceUrl = "http://localhost:8080/websvc/services/Banking";



Replace it with:

       String serviceUrl = "xfire.local://Banking";         



You'll see a dramatic increase in performance as the whole network layer is bypassed.

Limitations

XFire has some important limitations you should be aware of:

  • A good practice in developing Web services is to start from the WSDL. Most SOAP engines provide tools to generate service stubs from WSDL. XFire also provides such a tool. But it is annotations-based and hence needs J2SE 5.0. It's not a show-stopper for people like me who are still stuck in J2SE 1.4.x, because we have other ways to write clients, one of which was illustrated in this article's example.
  • Support for attachments, which is slated for a future release.
  • Easy-to-follow user guide; the XFire team has a lot of work to do here.


Conclusion

The current trend in Java is to simplify the usage of technologies. Thus, we are seeing a wave of POJO-based development efforts. At the same time, service-oriented architecture (SOA) and Web services have become hot topics in the industry. XFire truly fits this scenario. It enables POJOs to be exposed as Web services with minimum effort. Thus, it greatly smoothes the learning curve for novice developers who want to use this technology. At the same time, with its up-to-date standard compliance and rich API, XFire opens up many more opportunities for advanced users.

About the author

Shahid Ahmed is a software architect now consulting with a major wireless carrier in the U.S. He started developing software about 22 years ago, when Kaypro, Osborne, Apple II, and TRS-80s ruled the earth. For the last seven years, his focus has been mostly on Java. His current works involve SOA, Web services, messaging, POJOs, Spring, Ajax, etc. Shahid is a software addict who strives everyday to balance between a fascination for technology and love for social life.

Read more about Enterprise Java in JavaWorld's Enterprise Java section.

  • Print
  • Feedback

Resources