Home > SOA Tips > The Web Services Advisor > REST with Axis, Struts, ColdFusion and WCF
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

THE WEB SERVICES ADVISOR

REST with Axis, Struts, ColdFusion and WCF


William Brogden
05.28.2008
Rating: -3.50- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Starting with the relatively simple XML-RPC (remote procedure call) protocol ten years ago, frameworks and standards for Web services have steadily gotten more complicated. For some time, SOAP has seemed to have a lock on developer thinking while open source and commercial frameworks to support these evolving ideas have steadily grown into larger and more complex packages. As a reaction to increasing complexity, the REST (representational state transfer) style has gotten increasing developer mindshare. I thought it would be interesting to examine how the frameworks that got started before REST became popular have responded to this trend. First let's look at what the ideal REST style implies.

Degrees of REST compliance
As described in Fielding's dissertation, the REST style emphasizes Web resources and the URI address to access the resource. This is opposed to SOAP and XML-RPC orientation which emphasizes setting a process in motion that creates a resource. REST style proponents contend that the uniform interface of simple HTTP methods and headers lets you create services that are simple and easy to expand.

The HTTP1.1 protocol standard, RFC 2616, authored by Fielding and other experts, has very clear advice on how the methods should be used. The standard emphasizes that GET, HEAD, PUT and DELETE requests should be idempotent – that means that multiple identical requests should have the same effect as a single one. Many Web applications tend to ignore this requirement for the GET method.

Here is a summary of how strictly RESTful services should handle HTTP methods. I found that most of the older frameworks are just making a start on complying with this style.

  • GET - Retrieve a representation of a resource in a specified representation (Internet media type).
  • POST - Use the data in the request body to modify a resource. The URI identifies a resource that will handle the enclosed data.
  • PUT - The body of the request creates or sets the current state of a resource identified by the URI.
  • DELETE - Deletes a specified resource on the server.
  • HEAD - Retrieve information on the state of a resource such as the date last modified in the form of HTTP headers. The intent being to provide a way for a program to avoid an extra GET if the resource has not changed.

Apache Software Foundation - AXIS
An early toolkit originally created by IBM as SOAP4J found a home at the Apache Software Foundation as the SOAP project. However, it was not long before the need to support emerging standards such as WSDL prompted a redesign called Apache Axis, released in 2002. The current version, Axis 1.4 is still in use.

The next redesign, Axis2, started while the first Axis was still being developed. There is great potential for confusion when speaking of the Axis toolkits because both Axis and Axis2 are simultaneously in use with "version 1.4" the latest for both lines. Axis2 is intended to support more of the evolving SOAP, WSDL, and WS-* standards with a faster and more flexible architecture. Axis2 version 1.4 supports RESTful services with a bit of a kludge that falls short of full REST support.

Digging into the documentation, we find that Axis2 support for a RESTful GET is accomplished by reformatting a REST style URL into a SOAP request that is forwarded to the normal SOAP request processing with the response in an XML format that does not include the normal SOAP envelope. While this is sufficient for Ajax style support of XML consuming rich Internet applications (RIAs), it does not handle other resource types an application might need and there is no provision for use of the PUT and DELETE methods.

Apache Software Foundatiion - Struts
Apache Struts is one of the most popular open source frameworks for creating Java Web applications in the Struts 1 version. However, it appears that the complete redesign known as Struts 2 will be the place to look for REST style request support. There is a "REST Plugin" for Struts 2.1.1, which apparently is still in beta testing, that will make it easy to support REST style requests using Ruby on Rails style mapping of URLs to code.

The ColdFusion Framework
ColdFusion was one of the first (1995) Web development frameworks. Now owned by Adobe Systems, it is mainly aimed at creation of database driven Web sites with ColdFusion Markup Language. The latest, version 8, has provision for handling query style GET and POST requests and returning data to rich client applications in JSON or XML formats. However, interpretation of URI style requests is not supported. The ColdFusion engine can run in either the Java J2EE server or the .NET server environment.

Microsoft's Web service toolkits
Researchers at Microsoft pioneered the development of SOAP Web services and the SOAP protocol has been well supported in the various Microsoft development environments. Rather than a gradual evolution of existing frameworks, Microsoft has created a new one. The latest framework from Microsoft is the Windows Communication Foundation or WCF. This is a generalized Web services stack for building connected systems using the Microsoft .NET Framework. The emphasis is still on supporting SOAP and the WS-* standards, but the latest (.NET 3.5) version now provides for creating services that can be configured to be addressed in either SOAP or REST style. Provision is made for supporting the GET, POST, PUT and DELETE HTTP methods. While the examples I found emphasize return content types of JSON (JavaScript Object Notation) and XML, mechanisms are provided for recognizing requested content types and creating the correct response.

Conclusion
Generally speaking, the older frameworks have been undergoing major redesigns in the last few years to keep of with the pace of new developments so your old framework may come up with innovations to let you get started with RESTful Web services. However, if you are not already committed to a framework you might take a look at the totally new approaches I discussed in recent articles. Frameworks like Jersey and IBM's Project Zero don't carry any excess baggage from previous approaches.

References
The beginning of Web services with XML-RPC.

Apache Axis2 home page

Creating a RESTful Web service with the Windows Communcation Foundation API

Apache Struts framework home page

The RFC for the HTTP1.1 standard


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
The Web Services Advisor
What's new at the W3C
The elements of Web service performance
XMPP-Extensible Messaging and Presence Protocol: SOAP and REST get closer company
Find your server in the Cloud
Erlang and concurrency in service-orientated architectures
Backup to the compute cloud
SPARQL shines as RDF's query language
Testing Web services: Unit testing and monitoring
Web services for Windows CE
Testing Web services and RIAs

Representational State Transfer (REST)
Inside the SOA big tent; Azure at PDC; more
On lightweight Java frameworks and service-oriented architecture
Learn about Ruby on Rails programming
User combines open source ESB with data services to speed customer reports
Microsoft modeling strategy: Work in progress
Microsoft previews new Dublin composite app platform for SOA
WSO2 supports PHP during 'growth spurt' driven by SOA
REST architecture integrates data services to SaaS
SOA policy in a box
SOA ends era of big apps, opens door for Ruby on Rails

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
REST  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2001 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts