Java Web Services: Up and Running, 2/e (Paperback)
內容描述
content
Learn how to develop REST-style and SOAP-based web services and clients with this quick and thorough introduction. This hands-on book delivers a clear, pragmatic approach to web services by providing an architectural overview, complete working code examples, and short yet precise instructions for compiling, deploying, and executing them. You’ll learn how to write services from scratch and integrate existing services into your Java applications.
With greater emphasis on REST-style services, this second edition covers HttpServlet, Restlet, and JAX-RS APIs; jQuery clients against REST-style services; and JAX-WS for SOAP-based services. Code samples include an Apache Ant script that compiles, packages, and deploys web services.
- Learn differences and similarities between REST-style and SOAP-based services
- Program and deliver RESTful web services, using Java APIs and implementations
- Explore RESTful web service clients written in Java, JavaScript, and Perl
- Write SOAP-based web services with an emphasis on the application level
- Examine the handler and transport levels in SOAP-based messaging
- Learn wire-level security in HTTP(S), users/roles security, and WS-Security
- Use a Java Application Server (JAS) as an alternative to a standalone web server
Q&A with Martin Kalin, author of "Java Web Services: Up and Running, 2nd Edition"
Q. Why is your second edition of “Java Web Services: Up and Running” important for people to read right now?
A. Web services and their clients are an increasingly prominent aspect of the web. For example, social networking sites such as Facebook, Instagram, Twitter, and Tumblr together with e-commerce sites such as Amazon and eBay make available, through web services, the same data and functionality available through traditional websites. Indeed, it is rare nowadays to develop a website that is not paired with a web service.
Q. What will readers walk away with after reading "Java Web Services: Up and Running?"
A. The main informational points can be summarized as follows:
- Web services are a way to deliver data and functionality using existing technologies and infrastructures already in place. Such services represent a low-fuss approach to web-based applications.
- Web services represent a straightforward way to automate web-based tasks (for instance, ordering supplies from a vendor) and to integrate legacy software systems (for instance, a legacy COBOL system) with more modern systems.
- Web services are platform and language neutral: a web service written in a particular language and published on a particular platform is accessible to clients written in many other languages and executing on basically any computing device, from an industrial-strength server to a cell phone.
- Java provides complete coverage of web services, on the service and the client side; Java provides such coverage with rich options for programming and publishing web services.
- Web services come in two major flavors, REST-style and SOAP-based, and Java has excellent support for each flavor—on the service and the client side.
The book emphasizes code, on both the service and the client side. Accordingly, there are various full-code examples, on the service side, for all of popular Java APIs for doing REST-style and SOAP-based web services: HttpServlet, JAX-RS, Restlet, JAX-WS. There are also extensive examples on the client side, including clients against popular real-world services such as those from Amazon and Twitter. The book includes a full chapter on wire-level and users/roles security.
Q. What's the most exciting and important thing happening in this Java web services?
A. The distinction between traditional HTML-based websites and web services continues to blur. For one thing, modern websites typically contain JavaScript (in one dialect or another) embedded within the HTML; and embedded JavaScript is increasingly used to write clients against web services.
Q. Can you give us a few tips when getting started with Java Web Services?
A. 1. Traditional programming skills used to create Java-based websites using the JSP/ HttpServlet APIs transfer nicely to REST-style web services. The publication of a Java-based web service is essentially the same as that for a Java-based website (for example, a web server such as Tomcat or Jetty can be used for either).
2. Despite the growing popularity of REST-style services, SOAP-based services delivered over HTTP/HTTPS remain a programmer-friendly variant of REST-style services; and SOAP-based clients are typically easier to write than REST-style ones.
3. Programming a web service and then publishing it are nicely separated concerns: In general, how the service is programmed (for instance, the APIs used) has little or no impact on how the service is published (for instance, with a command-line publisher, a commercial-grade web server such as Tomcat, or a full-blown Java Application Server such as GlassFish or JBoss).
4. jQuery and other JavaScript dialects make it increasingly easy to embed web-service clients within HTML pages.
5. Securing a web service is essentially the same as securing a web site.