Java Web Services : Up and Running, 2nd Edition
معرفی کتاب «Java Web Services : Up and Running, 2nd Edition» نوشتهٔ Safari, an O'Reilly Media Company.; Kalin, Martin، منتشرشده توسط نشر O'Reilly Media در سال 2013. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Java Web Services : Up and Running, 2nd Edition» در دستهٔ بدون دستهبندی قرار دارد.
Overview: 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 Copyright......Page 4 Table of Contents......Page 5 What’s Changed in the Second Edition?......Page 9 Web Service APIs and Publication Options......Page 11 The Publication Options......Page 12 Chapter-by-Chapter Overview......Page 13 Tools and IDEs......Page 16 Conventions Used in This Book......Page 17 Safari® Books Online......Page 18 Acknowledgments......Page 19 Chapter 1. Web Services Quickstart......Page 21 Web Service Miscellany......Page 23 What Good Are Web Services?......Page 24 Web Services and Service-Oriented Architecture......Page 27 A Very Short History of Web Services......Page 28 From DCE/RPC to XML-RPC......Page 29 Distributed Object Architecture: A Java Example......Page 31 Web Services to the Rescue......Page 32 What Is REST?......Page 33 Verbs and Opaque Nouns......Page 37 Review of HTTP Requests and Responses......Page 38 HTTP as an API......Page 40 Two HTTP Clients in Java......Page 41 A First RESTful Example......Page 44 How the Predictions Web Service Works......Page 45 A Client Against the Predictions Web Service......Page 53 Why Use Servlets for RESTful Web Services?......Page 54 What’s Next?......Page 57 Chapter 2. RESTful Web Services: The Service Side......Page 59 A RESTful Service as an HttpServlet......Page 60 Implementation Details......Page 61 Sample Client Calls Against the predictions2 Service......Page 72 A RESTful Web Service as a JAX-RS Resource......Page 73 A First JAX-RS Web Service Using Jersey......Page 74 Publishing JAX-RS Resources with a Java Application......Page 75 Publishing JAX-RS Resources with Tomcat......Page 76 The Adage Class......Page 78 JAX-RS Generation of XML and JSON Responses......Page 82 Porting the Predictions Web Service to JAX-RS......Page 85 A RESTful Web Service as Restlet Resources......Page 95 Sample Calls Against the adages2 Service......Page 103 Publishing the adages2 Restlet Service Without a Web Server......Page 104 A RESTful Service as a @WebServiceProvider......Page 105 What’s Next?......Page 114 Chapter 3. RESTful Web Services: The Client Side......Page 115 A Perl Client Against a Java RESTful Web Service......Page 116 A Client Against the Amazon E-Commerce Service......Page 121 A Standalone JAX-B Example......Page 130 The XStream Option......Page 134 Another Client Against the Amazon E-Commerce Service......Page 138 The CTA Bus-Tracker Services......Page 143 RESTful Clients and WADL Documents......Page 146 The JAX-RS Client API......Page 152 JSON for JavaScript Clients......Page 154 JSONP and Web Services......Page 155 A Composed RESTful Service with jQuery......Page 157 An Ajax Polling Example......Page 160 What’s Next?......Page 163 Chapter 4. SOAP-Based Web Services......Page 165 A SOAP-Based Web Service......Page 166 The RandService in Two Files......Page 171 Clients Against the RandService......Page 172 A Java Client Against the RandService......Page 173 A C# Client Against the RandService......Page 176 A Perl Client Against the RandService......Page 177 The WSDL Service Contract in Detail......Page 180 The types Section......Page 182 The message Section......Page 183 The binding Section......Page 184 The service Section......Page 185 Java and XML Schema Data Type Bindings......Page 186 Wrapped and Unwrapped Document Style......Page 188 wsimport Artifacts for the Service Side......Page 191 SOAP-Based Clients Against Amazon’s E-Commerce Service......Page 193 Asynchronous Clients Against SOAP-Based Services......Page 199 What’s Next?......Page 202 Chapter 5. SOAP Handlers and Faults......Page 205 The Handler Level in SOAP-Based Services and Clients......Page 207 Handlers and Faults in the predictionsSOAP Service......Page 214 The Backend Support Classes......Page 219 From the Client to the Service......Page 221 Faults from the Application and Handler Levels......Page 231 Linking the Service-Side Handler to the Service......Page 232 A Handler Chain with Two Handlers......Page 233 SOAP-Based Web Services and Binary Data......Page 238 The Transport Level......Page 244 Axis2......Page 247 What’s Next?......Page 249 Chapter 6. Web Services Security......Page 251 Wire-Level Security......Page 252 HTTPS Basics......Page 253 Symmetric and Asymmetric Encryption/Decryption......Page 254 How HTTPS Provides the Three Security Services......Page 256 The HTTPS Handshake......Page 257 The HttpsURLConnection Class......Page 259 A Very Lightweight HTTPS Server and Client......Page 264 HTTPS in a Production-Grade Web Server......Page 274 Enforcing HTTPS Access to a Web Service......Page 276 An HTTPS Client Against the predictions2 Service......Page 277 Container-Managed Security......Page 280 Linking the Service web.xml with a Tomcat Security Realm......Page 283 The Client Side in Users/Roles Security......Page 285 Using the curl Utility for HTTPS Testing......Page 288 A @WebService Under HTTPS with Users/Roles Security......Page 289 Using a Digested Password Instead of a Password......Page 293 WS-Security......Page 295 Securing a @WebService with WS-Security......Page 297 What’s Next?......Page 310 Chapter 7. Web Services and Java Application Servers......Page 311 The Web Container......Page 312 The Enterprise Java Bean Container......Page 313 The Security Provider......Page 315 Toward a Lightweight JAS......Page 316 GlassFish Basics......Page 317 Servlet-Based Web Services Under GlassFish......Page 319 An Example with Mixed APIs......Page 322 An Interactive Website and a SOAP-Based Web Service......Page 328 A @WebService as a @Stateless Session EJB......Page 332 Packaging and Deploying the predictionsEJB Service......Page 337 A Client Against the predictionsEJB Service......Page 339 TomEE: Tomcat with Java EE Extensions......Page 341 Porting the predictionsEJB Web Service to TomEE......Page 342 Deploying an EJB in a WAR File......Page 343 Where Is the Best Place to Be in Java Web Services?......Page 344 Back to the Question at Hand......Page 348 Index......Page 351 About the Author......Page 359 Copyright 4 Table of Contents 5 Preface 9 What’s Changed in the Second Edition? 9 Web Service APIs and Publication Options 11 The Publication Options 12 Chapter-by-Chapter Overview 13 Tools and IDEs 16 Conventions Used in This Book 17 Using Code Examples 18 Safari® Books Online 18 How to Contact Us 19 Acknowledgments 19 Chapter 1. Web Services Quickstart 21 Web Service Miscellany 23 What Good Are Web Services? 24 Web Services and Service-Oriented Architecture 27 A Very Short History of Web Services 28 From DCE/RPC to XML-RPC 29 Distributed Object Architecture: A Java Example 31 Web Services to the Rescue 32 What Is REST? 33 Verbs and Opaque Nouns 37 Review of HTTP Requests and Responses 38 HTTP as an API 40 Two HTTP Clients in Java 41 A First RESTful Example 44 How the Predictions Web Service Works 45 A Client Against the Predictions Web Service 53 Why Use Servlets for RESTful Web Services? 54 What’s Next? 57 Chapter 2. RESTful Web Services: The Service Side 59 A RESTful Service as an HttpServlet 60 Implementation Details 61 Sample Client Calls Against the predictions2 Service 72 A RESTful Web Service as a JAX-RS Resource 73 A First JAX-RS Web Service Using Jersey 74 Publishing JAX-RS Resources with a Java Application 75 Publishing JAX-RS Resources with Tomcat 76 The Adage Class 78 JAX-RS Generation of XML and JSON Responses 82 Porting the Predictions Web Service to JAX-RS 85 A RESTful Web Service as Restlet Resources 95 Sample Calls Against the adages2 Service 103 Publishing the adages2 Restlet Service Without a Web Server 104 A RESTful Service as a @WebServiceProvider 105 What’s Next? 114 Chapter 3. RESTful Web Services: The Client Side 115 A Perl Client Against a Java RESTful Web Service 116 A Client Against the Amazon E-Commerce Service 121 A Standalone JAX-B Example 130 The XStream Option 134 Another Client Against the Amazon E-Commerce Service 138 The CTA Bus-Tracker Services 143 RESTful Clients and WADL Documents 146 The JAX-RS Client API 152 JSON for JavaScript Clients 154 JSONP and Web Services 155 A Composed RESTful Service with jQuery 157 An Ajax Polling Example 160 What’s Next? 163 Chapter 4. SOAP-Based Web Services 165 A SOAP-Based Web Service 166 The RandService in Two Files 171 Clients Against the RandService 172 A Java Client Against the RandService 173 A C# Client Against the RandService 176 A Perl Client Against the RandService 177 The WSDL Service Contract in Detail 180 The types Section 182 The message Section 183 The portType Section 184 The binding Section 184 The service Section 185 Java and XML Schema Data Type Bindings 186 Wrapped and Unwrapped Document Style 188 wsimport Artifacts for the Service Side 191 SOAP-Based Clients Against Amazon’s E-Commerce Service 193 Asynchronous Clients Against SOAP-Based Services 199 What’s Next? 202 Chapter 5. SOAP Handlers and Faults 205 The Handler Level in SOAP-Based Services and Clients 207 Handlers and Faults in the predictionsSOAP Service 214 The Backend Support Classes 219 From the Client to the Service 221 Signature Verification 231 Faults from the Application and Handler Levels 231 Linking the Service-Side Handler to the Service 232 A Handler Chain with Two Handlers 233 SOAP-Based Web Services and Binary Data 238 The Transport Level 244 Axis2 247 What’s Next? 249 Chapter 6. Web Services Security 251 Wire-Level Security 252 HTTPS Basics 253 Symmetric and Asymmetric Encryption/Decryption 254 How HTTPS Provides the Three Security Services 256 The HTTPS Handshake 257 The HttpsURLConnection Class 259 A Very Lightweight HTTPS Server and Client 264 HTTPS in a Production-Grade Web Server 274 Enforcing HTTPS Access to a Web Service 276 An HTTPS Client Against the predictions2 Service 277 Container-Managed Security 280 Linking the Service web.xml with a Tomcat Security Realm 283 The Client Side in Users/Roles Security 285 Using the curl Utility for HTTPS Testing 288 A @WebService Under HTTPS with Users/Roles Security 289 Using a Digested Password Instead of a Password 293 WS-Security 295 Securing a @WebService with WS-Security 297 What’s Next? 310 Chapter 7. Web Services and Java Application Servers 311 The Web Container 312 The Message-Oriented Middleware 313 The Enterprise Java Bean Container 313 The Naming and Lookup Service 315 The Security Provider 315 The Client Container 316 The Database System 316 Toward a Lightweight JAS 316 GlassFish Basics 317 Servlet-Based Web Services Under GlassFish 319 An Example with Mixed APIs 322 An Interactive Website and a SOAP-Based Web Service 328 A @WebService as a @Stateless Session EJB 332 Packaging and Deploying the predictionsEJB Service 337 A Client Against the predictionsEJB Service 339 TomEE: Tomcat with Java EE Extensions 341 Porting the predictionsEJB Web Service to TomEE 342 Deploying an EJB in a WAR File 343 Where Is the Best Place to Be in Java Web Services? 344 Back to the Question at Hand 348 Index 351 About the Author 359 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{u2019}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 Annotation 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. Youll 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 servicesProgram and deliver RESTful web services, using Java APIs and implementationsExplore RESTful web service clients written in Java, JavaScript, and PerlWrite SOAP-based web services with an emphasis on the application levelExamine the handler and transport levels in SOAP-based messagingLearn wire-level security in HTTP(S), users/roles security, and WS-SecurityUse a Java Application Server (JAS) as an alternative to a standalone web server 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 servicesProgram and deliver RESTful web services, using Java APIs and implementationsExplore RESTful web service clients written in Java, JavaScript, and PerlWrite SOAP-based web services with an emphasis on the application levelExamine the handler and transport levels in SOAP-based messagingLearn wire-level security in HTTP(S), users/roles security, and WS-SecurityUse a Java Application Server (JAS) as an alternative to a standalone web server This example-driven book offers a thorough introduction to Java’s APIs for both XML Web Services (JAX-WS) and RESTful Web Services (JAX-RS). *Java Web Services: Up and Running* takes a clear, pragmatic approach to these technologies by providing a mix of architectural overview, complete working code examples, and short yet precise instructions for compiling, deploying, and executing an application. You'll learn how to write web services from scratch and integrate existing services into your Java applications. With *Java Web Services: Up and Running*, you will: - Understand the distinction between SOAP-based and REST-style services - Write, deploy, and consume SOAP-based services in core Java - Understand the Web Service Definition Language (WSDL) service contract - Recognize the structure of a SOAP message - Learn how to deliver Java-based RESTful web services and consume commercial RESTful services - Know security requirements for SOAP- and REST-based web services - Learn how to deploy JAX-WS services in various environments Ideal for students as well as experienced programmers, *Java Web Services: Up and Running* is the concise guide you need to start working with these technologies right away.
دانلود کتاب Java Web Services : Up and Running, 2nd Edition