没有合适的资源?快使用搜索试试~ 我知道了~
首页RESTful PHP Web Services
资源详情
资源评论
资源推荐
RESTful PHP Web Services
Samisa Abeysinghe
Chapter No. 5
"Resource-Oriented Clients"
For More Information: www.packtpub.com/restful-php-web-services/book
In this package, you will find:
A Biography of the author of the book
A preview chapter from the book, Chapter NO.5 "Resource-Oriented Clients"
A synopsis of the book’s content
Information on where to buy this book
About the Author
Samisa Abeysinghe is Director, Engineering at WSO2. Samisa pioneered the Apache
Axis2/C effort and architected the core of the Apache Axis2/C Web services engine. He
continues to be an active contributor in the Apache Axis2/C project. His involvement in
open-source projects began in 2004 when he started working with the Apache Axis
C/C++ project.
Prior to his current role, Samisa played the project lead role for the WSO2 Web Services
Framework for PHP project, which provides comprehensive support for building both
SOAP and REST services and clients.
"No man is an island"—John Donne
As human beings, we do not thrive when isolated from others. This
book was no exception. Many people contributed to the successful
completion of this book, and I would like to acknowledge all those
who contributed.
First, I must thank Douglas Paterson. Douglas, Senior Acquisition
Editor of Packt Publishing Ltd., is the one who initially proposed to me
that I write this book. And thanks to him, this book was born.
For More Information: www.packtpub.com/restful-php-web-services/book
Next, my gratitude goes to Sanjiva Weerawarana, Founder, Chairman,
and CEO ofWSO2, Inc. When I first consulted Sanjiva on his thoughts
on whether I should be writing this book, he encouraged me and even
offered to help.
Speaking about encouragement, I must thank my mother, who
checked, on a weekly basis, if I was continuing with my work on the
book and the progress that I was making on that front.
The staff at Packt Publishing Ltd. helped a great deal to make this book
a reality. I would like thank Rajashree Hamine the project coordinator,
Swapna Verlekar the development editor, and Siddharth Mangarole the
technical editor. I would also like to thank all others from Packt
Publishing Ltd. who contributed to this book in many ways.
I would also like to thank some of my WSO2 colleagues, who worked
with me closely on the scripting projects, specially WSO2 WSF/PHP. I
would like to mention Nandika, Dimuthu, Chinthana, and Buddhika.
Though they did not work on this book directly, they helped me a lot to
understand PHP while working on WSF/PHP.
For More Information: www.packtpub.com/restful-php-web-services/book
RESTful PHP Web Services
This book discusses the use of PHP to implement web applications based on REST
architectural principles. Web services are a popular breed of web application technologies
in today's programmable Web, and REST is the most popular style used in there. This
book uses real-world examples as well as step-by-step guidelines to explain how to
design REST-style services and clients from the ground up and how to use PHP
programming constructs and frameworks to implement those services and clients.
What This Book Covers
Chapter 1 introduces the concepts related to the programmable Web, shows how HTTP
and web services are related to each other, introduces the principles behind REST,
explains how HTTP verbs are used in REST applications, explains the need for RESTFul
web services while building PHP web applications, and introduces some frameworks and
tools that can be used to work with REST in PHP.
Chapter 2 takes a first look at REST with PHP. While providing and consuming REST-
style web services, the primary pre-requisites are an HTTP server or an HTTP client
library and an XML parser library. In this chapter, we will see how to use the PHP CURL
API to consume web services using various HTTP verbs such as
HTTP GET, POST, PUT,
and
DELETE. The DOM API and SimpleXML API for building XML object structures
and parsing XML streams are also discussed. We will discuss in detail how to build XML
request payloads and also how to parse XML response payloads. The final section of this
chapter demonstrates how to use the HTTP client features and XML parser features to
invoke the Flickr REST API.
Chapter 3 looks into some real-world applications and discusses how to combine
multiple service interfaces to build value-added custom applications. In this chapter,
we will see how to use RSS or ATOM feeds, Yahoo search API, and Yahoo maps API.
With the know-how you gain in this chapter and the previous chapters, you could build
very powerful value-added applications like mashups using publicly available REST-
style services.
Chapter 4 covers the steps that you would have to follow in designing and implementing
a resource-oriented service in detail. Identifying resources and business operations for a
given problem statement, designing the URI patterns, selecting the correct HTTP verbs,
mapping URI and HTTP verbs to business operations are covered using the library
example. Implementing the services and business operations using PHP is explained in
detail, step by step.
For More Information: www.packtpub.com/restful-php-web-services/book
Chapter 5 covers the steps that you would have to follow in designing and implementing
resource-oriented clients in detail. The design of the clients is governed by the design of
the service. And the client programmer needs to understand the semantics of the service,
which is usually communicated through service API documentation. In the examples of
this chapter, we will use the library service API designed in Chapter 4 to explain how we
could use an existing API while designing PHP applications.
Chapter 6 uses the REST classes provided with the Zend Framework to implement the
sample library system. The design of the service and client are covered, along with the
MVC concepts supported by the Zend Framework. We will discuss how resources map to
the model in MVC, and how HTTP verbs when combined with resource URIs map to the
controller in MVC. We will explore how to combine Zend_Rest_Server with
Zend_Controller to implement the business operations of the service and how to use
Zend_Rest_Client class to consume the services.
Chapter 7 looks into the use of tools to trace and look into the messages to figure out
possible problems with request and response pairs passed between clients and services.
That helps with debugging and troubleshooting of services and clients. We will also look
into how we could look at the XML documents to figure out possible problems in
building XML in this chapter, and discuss how we can locate problems in parsing
incoming XML messages.
Appendix A introduces the WSO2 Web Services Framework for PHP (WSO2 WSF/PHP)
and discusses how to use the WSF/PHP service API to implement the sample Library
system as a REST service and implement a REST client to consume it. We will also look
into using the SOAP features provided in the frameworks to implement a SOAP client to
consume the same service using SOAP-style messages. This chapter also discusses the
differences between REST and SOAP message styles, in brief.
Appendix B introduces a PHP class named RESTClient that can be used to consume
REST-style services. This class supports all key HTTP verbs,
GET, POST, PUT, and
DELETE. The advantage of using such a class is that it minimizes the complexity of your
client code. At the same time, you can re-use this class for all your REST-style client
implementations. This PHP class is sufficient for most simple REST-style client
programs, and requires no third-party libraries. However, if you want to implement
services and also want advanced clients, it is advised to use a more established
framework such as Zend Framework or WSO2 WSF/PHP introduced in Chapter 6 and
Appendix A of this book.
剩余27页未读,继续阅读
cumtwhitesnow
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2023年中国辣条食品行业创新及消费需求洞察报告.pptx
- 2023年半导体行业20强品牌.pptx
- 2023年全球电力行业评论.pptx
- 2023年全球网络安全现状-劳动力资源和网络运营的全球发展新态势.pptx
- 毕业设计-基于单片机的液体密度检测系统设计.doc
- 家用清扫机器人设计.doc
- 基于VB+数据库SQL的教师信息管理系统设计与实现 计算机专业设计范文模板参考资料.pdf
- 官塘驿林场林防火(资源监管)“空天地人”四位一体监测系统方案.doc
- 基于专利语义表征的技术预见方法及其应用.docx
- 浅谈电子商务的现状及发展趋势学习总结.doc
- 基于单片机的智能仓库温湿度控制系统 (2).pdf
- 基于SSM框架知识产权管理系统 (2).pdf
- 9年终工作总结新年计划PPT模板.pptx
- Hytera海能达CH04L01 说明书.pdf
- 数据中心运维操作标准及流程.pdf
- 报告模板 -成本分析与报告培训之三.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论12