Programming Web Services with Perl

Book Description

Given Perl's natural fit for web applications development, it's no surprise that Perl is also a natural choice for web services development. It's the most popular web programming language, with strong implementations of both SOAP and XML-RPC, the leading ways to distribute applications using web services. But books on web services focus on writing these applications in Java or Visual Basic, leaving Perl programmers with few resources to get them started. Programming Web Services with Perl changes that, bringing Perl users all the information they need to create web services using their favorite language. Programming Web Services with Perl steers clear of the hype surrounding web services and concentrates on what is useful and practical. The book introduces the major web services standards, such as XML-RPC, SOAP, WSDL, and UDDI, and shows how to implement Perl servers and clients using these standards. You'll find detailed references on both the XML and SOAP toolkits, and learn when to use one technology in favor of the other. The book is rich with programming examples that you'll find useful well past the learning stage. And, moving beyond the basics, the book offers solutions to problems of security, authentication, and scalability. Some of the topics covered in the book are:

  • HTTP and XML basics

  • XML-RPC and the toolkits

  • SOAP and toolkits

  • SOAP::Lite

  • Using SOAP with SMTP and other protocols

  • Advertising and discovering with UDDI and WSDL

  • The REST methodology

  • The future of web services

Programming Web Services with Perl was written for Perl programmers who have no prior knowledge of web services. You can pick up this book without any understanding of XML-RPC or SOAP and be able to apply these technologies easily, through the use of publicly available Perl modules detailed in the book. If you're interested in applying XML-RPC and SOAP technologies to distributed programming applications, then Programming Web Services with Perl is a book you'll want to have.

Publisher Resources

Download Example Code

Table of Contents

  1. Table of Contents
  2. Preface
    1. Audience for This Book
    2. Structure of This Book
    3. Conventions Used in This Book
    4. Comments and Questions
    5. Acknowledgments
      1. Randy
      2. Pavel
  3. Introduction to Web Services
    1. History
    2. The Web Services Dream
    3. The Web Services Cold Shower
    4. Who to Believe?
    5. Web Services in the Real World
  4. HTTP and XML Basics
    1. HTTP
      1. The Request/Response Cycle
      2. HTTP Message Structure
        1. Examining the request
        2. Examining the response
      3. Reading More About HTTP and LWP
    2. XML
      1. Self-Describing Data
        1. Elements and namespaces
        2. Attributes
        3. Data
        4. Comments, processing instructions, and specialized content
      2. Describing XML with DTD and XML Schema
        1. The DTD
        2. XML Schema
      3. XML Modules and Tools for Perl
        1. XML::Parser
        2. XML::LibXML and XML::LibXSLT
        3. XML::SAX
        4. XML::XPath, XML::Simple, and others
    3. XML Schema
      1. Why Replace the DTD?
        1. Document structure versus data structure
        2. Understanding more about XML Schema
      2. Schema Components (1/2)
      3. Schema Components (2/2)
        1. The predefined simple types
        2. Primary components
        3. Attributes
        4. Elements
        5. Simple and complex types
        6. A unified example schema
      4. XML Schema in SOAP and Related Areas
  5. Introduction to XML-RPC
    1. History of XML-RPC
      1. The XML in XML-RPC (1/2)
      2. The XML in XML-RPC (2/2)
        1. Data encoding
        2. Arrays and structures
        3. Making a request
        4. Creating a response
        5. Sending an error response
      3. Client and Server Communication
      4. Method Signatures and Overloading
    2. Example Client: Meerkat
      1. The Meerkat Service
      2. From Meerkat Query to HTML Sidebar
    3. Limitations of XML-RPC
      1. Status of the Specification
      2. XML-RPC and Interoperability
      3. Choosing XML-RPC over SOAP
  6. Programming XML-RPC
    1. Perl Toolkits for XML-RPC
    2. RPC::XMLSimple
      1. Client Example: meer2html.pl
      2. The RPC::XMLSimple::Client Class in Detail
      3. A Server Example: Providing “Fortunes”
      4. The RPC::XMLSimple::Daemon Class in Detail
    3. XMLRPC::Lite
      1. Client Example: meer2html.pl
      2. The XMLRPC::Lite Class in Detail
      3. Debugging
      4. Auto-Dispatch
      5. The Fortune Server Using XMLRPC::Lite
      6. The XMLRPC::Lite Server Classes
    4. RPC::XML
      1. Client Example: meer2html.pl
      2. The RPC::XML::Client Class in Detail
      3. The Fortune Server Using RPC::XML::Server
      4. The RPC::XML::Server Class in Detail
        1. Managing server-side code with XPL files
      5. The Introspection Interface for Servers
      6. Writing for Apache with Apache::RPC::Server
      7. Configuring Server Objects
      8. The Apache::RPC::Status Monitor
  7. Introduction to SOAP
    1. Background
    2. XML Definitions
      1. The Basic Message Structure
      2. The Envelope Tag: Declaring Namespaces
      3. The Header Tag: Routing and More (1/2)
      4. The Header Tag: Routing and More (2/2)
        1. The encodingStyle attribute
        2. Actors, roles, nodes, and responsibility
        3. The actor/role attributes
        4. The mustUnderstand attribute
        5. Attribute placement and example
      5. The Body Tag: Anatomy of a Message
      6. Expressing and Encoding Data (1/2)
      7. Expressing and Encoding Data (2/2)
        1. XML Schema and encoding
        2. Simple types, values and enumerations
        3. Compound types and values
        4. Accessors, scoping, and reference
        5. Arrays and partial arrays
        6. Structures and generic compound types
        7. The SOAP root attribute
      8. Signaling a Problem: Faults
        1. Fault elements
        2. Predefined faults
    3. RPC over SOAP
      1. Supplying the RPC Information
      2. Putting the Call and Response in the Body
      3. Use of the SOAP Header
      4. RPC Faults
    4. SOAP Transport
    5. Further Reading
  8. Programming SOAP
    1. A Toolkit Approach
    2. DevelopMentor’s SOAP Module
      1. Example: Client to Convert a Number to Words
        1. Autogenerated XML
    3. The SOAP::Lite Module
      1. Installing SOAP::Lite
      2. Using SOAP::Lite for Clients (1/4)
      3. Using SOAP::Lite for Clients (2/4)
      4. Using SOAP::Lite for Clients (3/4)
      5. Using SOAP::Lite for Clients (4/4)
        1. Number-to-text conversion with SOAP::Lite
        2. Translating a use.perl.org journal stream to RSS
        3. Basic classes and components
        4. Dispatching methods and the object style
        5. Managing data with SOAP::Data and SOAP::SOM
        6. Example: Automatically announcing CPAN uploads
    4. Other SOAP-Related Modules
      1. SOAP::payload
      2. SOAP::Lite::SmartProxy
      3. Meta::Comm::Soap
  9. Serving SOAP over HTTP
    1. Basic SOAP::Lite Servers
    2. The Application
    3. Designing the Server
      1. Supporting Code
      2. Managing the Interface
      3. Choosing the HTTP Vehicle
    4. Tying the Interface Code to SOAP
      1. Starting Out
      2. Subclassing the Components
        1. WishListCustomer::Daemon
        2. WishListCustomer::SOAP
      3. Revising the Daemon-Based Server
      4. Simple Access with a SOAP::Lite Client
    5. Improving the Code and the Service
      1. Moving the Server to Apache
      2. Revisiting the Interface
        1. Designing WishListCustomer::SOAP2
        2. Accessing the SOAP envelope
        3. Testing the new method
    6. Ideas for Further Exploration
  10. SOAP Services Without HTTP
    1. Choosing a Protocol
    2. Authentication
      1. Server Authentication
        1. Designing the new scheme
        2. Creating a generic server class
      2. Client Authentication
        1. Custom headers with SOAP::Header
        2. WishListCustomer::Client as a shortcut
    3. Transports with Server and Client
      1. Using SOAP::Transport::TCP
        1. SOAP::Transport::TCP::Server
        2. SOAP::Transport::TCP::Client
      2. Using SOAP::Transport::JABBER
        1. Creating a Jabber-based server
        2. The Jabber-based client
      3. Using SOAP::Transport::MQ
      4. Using POP3 and MAILTO
        1. SOAP::Transport::POP3::Server
        2. SOAP::Transport::MAILTO::Client
    4. Standalone Protocols
      1. SOAP::Transport::IO
      2. SOAP::Transport::FTP::Client
      3. SOAP::Transport::LOCAL::Client
    5. Creating New Transport Modules
      1. Writing a Server Transport
        1. Specialized constructors
        2. Writing a localized handle method
        3. Other server methods
      2. Writing a Client Transport
        1. Naming the client class
        2. Constructors
        3. The send_receive method
        4. Other client methods
      3. Example Transport Module
  11. Service Description with WSDL
    1. Basic WSDL
      1. Starting Simple
      2. The Parts of a WSDL Document (1/3)
      3. The Parts of a WSDL Document (2/3)
      4. The Parts of a WSDL Document (3/3)
        1. Starting a WSDL document
        2. Documentation, types, and messages
        3. Operations and portType
        4. Bindings
        5. Service definitions
      5. HTTP and MIME Binding in WSDL
        1. Extending WSDL with HTTP
        2. Using the MIME extension elements
      6. Overloading Operations in WSDL
        1. Overloading when declaring operations
        2. Implementing overloaded operations within bindings
        3. Why bother with overloading in Perl?
      7. Other WSDL Elements
        1. Controlling arguments with parameterOrder
        2. Document-style message encoding
        3. Modular WSDL with the import element
    2. WSDL Programming
      1. WSDL Schema Support in SOAP::Lite
        1. SOAP::Lite client support for WSDL
        2. Code-generation based on WSDL
        3. SOAP::Schema shortcomings
  12. Service Advertising and Discovery with UDDI
    1. Defining UDDI
      1. Basic UDDI Data Structures (1/2)
      2. Basic UDDI Data Structures (2/2)
        1. Special data and source considerations
        2. Details of businessEntity and publisherAssertion
        3. Details of businessService
        4. Details of bindingTemplate
        5. tModel, tModelInstanceInfo, and referencing
      3. Publish and Query Interfaces (1/2)
      4. Publish and Query Interfaces (2/2)
        1. The querying routines
        2. Using findQualifiers in calls
        3. Publishing and editing business information
        4. Further reading
    2. Programming with UDDI::Lite
      1. The UDDI::Lite Family
        1. Connecting through UDDI::Lite
        2. Getting and reading data from UDDI::Data
      2. Showing More Detail for a Business
        1. The idea
        2. Using UDDI::Lite with auto-dispatch
  13. REST: Representational State Transfer
    1. Defining REST
      1. The Scientific Definition
      2. The Practical Definition
    2. REST Principles
      1. Aesthetics of URI Design
        1. URI syntax
        2. Resource modeling
      2. Methods
        1. GET method
        2. POST method
        3. DELETE method
        4. PUT method
      3. Security
    3. Programming REST
      1. REST Primer
      2. Modeling Resources
      3. Creating Multiple Representations
      4. Developing REST Applications
      5. Working with POST, PUT, and DELETE Methods
      6. Implementing a Purchase Order Service
        1. Two disadvantages of using the POST method
        2. Two disadvantages of the GET and PUT combination
        3. Choosing the implementation
      7. Implementing Cover Page Service
      8. Documenting Service API
      9. What Makes REST Hard
      10. REST and SOAP
  14. Advanced Web Services Topics
    1. Message Routing
      1. Web Services Routing Protocol (WS-Routing)
      2. Web Services Referral Protocol (WS-Referral)
    2. Packaging
      1. MIME and SOAP with Attachments
      2. DIME and WS-Attachments
    3. Security
      1. Key Concepts
      2. Transport Level Security
      3. XML Security (1/2)
      4. XML Security (2/2)
        1. XML Signature Syntax and Processing (XML Signature)
        2. XML Encryption
        3. XML Key Management (XKMS)
        4. Security Assertion Markup Language (SAML)
        5. XML Access Control Markup Language (XACML)
      5. Web Services Security
        1. Web Services Security Language (WS-Security)
        2. WS-Policy, WS-Trust, WS-Privacy, WS-SecureConversations, WS-Federation, and WS-Authorization
    4. Services Discovery
      1. Web Services Inspection Language (WS-Inspection or WSIL)
    5. Reliable Messaging
      1. HTTPR
    6. Business Process Management
      1. Document and RPC Styles
      2. Distributed Transactions
      3. Transactions and Coordination
        1. Web Services Coordination (WS-Coordination)
        2. Web Services Transaction (WS-Transaction)
        3. Business Transaction Protocol (BTP)
      4. Business Process Specifications
        1. Business Process Execution Language (BPEL)
    7. Implementation Considerations
      1. Internationalization
      2. Performance and Optimization
    8. WS-Next
  15. XML-RPC Toolkit Programming Reference
    1. RPC::XMLSimple
      1. RPC::XMLSimple
      2. RPC::XMLSimple::Client
      3. RPC::XMLSimple::Daemon
    2. XMLRPC::Lite
      1. XMLRPC::Lite
        1. XMLRPC::Lite
        2. XMLRPC::Data
        3. XMLRPC::SOM
        4. XMLRPC::Deserializer and XMLRPC::Serializer
        5. XMLRPC::Server
        6. XMLRPC::Server::Parameters
      2. XMLRPC::Transport::HTTP
        1. XMLRPC::Transport::HTTP::CGI
        2. XMLRPC::Transport::HTTP::Daemon
        3. XMLRPC::Transport::HTTP::Apache
      3. XMLRPC::Transport::POP3
      4. XMLRPC::Transport::TCP
    3. RPC::XML
      1. RPC::XML
      2. RPC::XML::Client
      3. RPC::XML::Server
      4. Server-Side Code Classes
        1. RPC::XML::Method
        2. RPC::XML::Procedure
        3. RPC::XML::Function
      5. Apache::RPC::Server
      6. Apache::RPC::Status
  16. SOAP::Lite Programming Reference
    1. SOAP::Lite
      1. SOAP::Lite
      2. SOAP::Data
      3. SOAP::SOM
      4. SOAP::Fault
      5. SOAP::Transport
      6. SOAP::Serializer
      7. SOAP::Header
      8. SOAP::Constants
      9. SOAP::Schema
      10. SOAP::Schema::WSDL
      11. SOAP::Client
      12. SOAP::Server
      13. SOAP::Server::Parameters
      14. SOAP::Trace
    2. SOAP Transport Classes
      1. SOAP::Transport::FTP
        1. SOAP::Transport::FTP::Client
      2. SOAP::Transport::HTTP
        1. SOAP::Transport::HTTP::Client
        2. SOAP::Transport::HTTP::Server
        3. SOAP::Transport::HTTP::CGI
        4. SOAP::Transport::HTTP::Daemon
        5. SOAP::Transport::HTTP::Apache
        6. SOAP::Transport::HTTP::FCGI
      3. SOAP::Transport::IO
        1. SOAP::Transport::IO::Server
      4. SOAP::Transport::JABBER
        1. SOAP::Transport::JABBER::Client
        2. SOAP::Transport::JABBER::Server
      5. SOAP::Transport::LOCAL
        1. SOAP::Transport::LOCAL::Client
      6. SOAP::Transport::MAILTO
        1. SOAP::Transport::MAILTO::Client
      7. SOAP::Transport::MQ
        1. SOAP::Transport::MQ::Client
        2. SOAP::Transport::MQ::Server
      8. SOAP::Transport::POP3
        1. SOAP::Transport::POP3::Server
      9. SOAP::Transport::TCP
        1. SOAP::Transport::TCP::Client
        2. SOAP::Transport::TCP::Server
    3. The Apache Wrapper
      1. Apache::SOAP
    4. UDDI::Lite
      1. UDDI::Lite
      2. UDDI::Data
      3. UDDI::SOM
      4. UDDI::Serializer and UDDI::Deserializer
  17. XML-RPC Example Code
    1. Basic Meerkat Client (Chapter3)
    2. XML-RPC Toolkit Samples (Chapter4)
      1. The RPC::XMLSimple Examples
      2. The XMLRPC::Lite Examples
      3. The RPC::XML Examples
      4. The XRFortune.pm Module
      5. The listMethods.xpl File
  18. SOAP Example Code
    1. HTTP SOAP Code (Chapter7)
      1. WishListCustomer
      2. SoapExUser
      3. SoapExBook
      4. The First HTTP::Daemon Server
      5. WishListCustomer::Daemon
      6. WishListCustomer::SOAP
      7. The Second HTTP::Daemon Server
      8. The SOAP::Lite Client to Format a Wish List
      9. WishListCustomer::Apache
      10. WishListCustomer::SOAP2
      11. The Third HTTP::Daemon Server
      12. The SOAP::Lite Client to Test FindBooks
    2. SOAP with Other Protocols (Chapter8)
      1. The Generic Transport Class
      2. The Subclass of SOAP::Lite
      3. A TCP-Based Server
      4. A Generic Client (TCP by Default)
      5. A Jabber-Based Server
      6. The MQ-Based Server
      7. The POP3-Based Server
      8. The MAILTO Client
      9. The IO-Based Filter
      10. The FTP Client
      11. The LOCAL Example
      12. The Sample Transport Module (1/2)
      13. The Sample Transport Module (2/2)
  19. WSDL and UDDI Examples
    1. The wishlist.wsdl File
    2. The useperlorg.wsdl File (1/2)
    3. The useperlorg.wsdl File (2/2)
    4. The show_biz UDDI Application
  20. Bibliography and References
    1. Bibliography
    2. Additional Recommended Books
    3. Web Pages
      1. General XML and XML Schema
      2. XML-RPC
      3. SOAP
      4. WSDL
      5. UDDI
      6. REST
  21. Index (1/7)
  22. Index (2/7)
  23. Index (3/7)
  24. Index (4/7)
  25. Index (5/7)
  26. Index (6/7)
  27. Index (7/7)

Product Information

  • Title: Programming Web Services with Perl
  • Author(s): Randy J. Ray, Pavel Kulchenko
  • Release date: December 2002
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596002060