没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Table of Contents
Foreword..............................................................................................................................................................1
Preface..................................................................................................................................................................5
Audience..................................................................................................................................................5
Organization.............................................................................................................................................5
Conventions Used in This Book..............................................................................................................6
How to Contact Us...................................................................................................................................6
Acknowledgments....................................................................................................................................7
Chapter 1. Introduction......................................................................................................................................9
1.1 What XML−RPC Does......................................................................................................................9
1.2 Where XML−RPC Excels...............................................................................................................11
1.3 A Quick Tour of the Minefields.......................................................................................................12
Chapter 2. The XML−RPC Protocol..............................................................................................................15
2.1 Choreography...................................................................................................................................15
2.2 Data Types.......................................................................................................................................16
2.3 Request Format................................................................................................................................23
2.4 Response Format..............................................................................................................................27
2.5 The Nil Value...................................................................................................................................31
2.6 A DTD for XML−RPC....................................................................................................................31
Chapter 3. Client−Server Communication: XML−RPC in Java.................................................................33
3.1 Why XML−RPC for Java?..............................................................................................................33
3.2 The XML−RPC Java Library..........................................................................................................35
3.3 Building XML−RPC Clients...........................................................................................................39
3.4 Building XML−RPC Servers...........................................................................................................40
3.5 Creating XML−RPC Handlers.........................................................................................................43
3.6 Three Practical Examples................................................................................................................46
3.7 Moving Toward Cross−Platform Peer−to−Peer..............................................................................56
Chapter 4. XML−RPC and Perl......................................................................................................................57
4.1 Perl's Implementation of XML−RPC..............................................................................................57
4.2 Data Types.......................................................................................................................................58
4.3 XML−RPC Clients..........................................................................................................................64
4.4 XML−RPC Servers..........................................................................................................................69
4.5 Integrating XML−RPC into a Web Server......................................................................................75
Chapter 5. Integrating Web Applications: XML−RPC in PHP...................................................................77
5.1 Getting the XML−RPC Library for PHP.........................................................................................77
5.2 Understanding the Client Classes....................................................................................................78
5.3 Mapping Data Between PHP and XML−RPC.................................................................................78
5.4 Invoking Methods............................................................................................................................82
5.5 Building XML−RPC Servers in PHP..............................................................................................86
5.6 Connecting Web Applications.........................................................................................................89
5.7 What PHP and XML−RPC Can Do.................................................................................................98
Chapter 6. XML−RPC and Python...............................................................................................................101
6.1 Python Implementations of XML−RPC........................................................................................101
6.2 Installing PythonWare XML−RPC................................................................................................101
i
Table of Contents
Chapter 6. XML−RPC and Python
6.3 Data Types.....................................................................................................................................102
6.4 XML−RPC Clients........................................................................................................................105
6.5 XML−RPC Servers........................................................................................................................108
6.6 Integrating XML−RPC into a Web Server....................................................................................116
6.7 Using Zope as an XML−RPC Server............................................................................................118
Chapter 7. Bridging XML−RPC and COM: XML−RPC in ASP..............................................................121
7.1 Using XML−RPC with ASP..........................................................................................................121
7.2 Making Active Server Pages More Active....................................................................................122
7.3 Data Types and the API.................................................................................................................124
7.4 Building an Address Book Web Service with ASP.......................................................................125
7.5 Talking to MS Access from Linux.................................................................................................132
7.6 An XML−RPC Client in ASP........................................................................................................133
7.7 Creating a Window to Linux..........................................................................................................138
7.8 Connections and Caveats...............................................................................................................140
Chapter 8. XML−RPC and the Web Services Landscape..........................................................................143
8.1 The Web Services Vision...............................................................................................................143
8.2 Public XML−RPC Services...........................................................................................................143
8.3 Design Considerations for Any XML−RPC Application..............................................................144
8.4 Beyond XML−RPC.......................................................................................................................146
8.5 Protocol Design Choices................................................................................................................149
8.6 XML−RPC and Web Services.......................................................................................................150
Appendix A. The XML You Need for XML−RPC......................................................................................153
A.1 What is XML?...............................................................................................................................153
A.2 Anatomy of an XML Document...................................................................................................153
A.3 Character Encodings.....................................................................................................................158
A.4 Validity.........................................................................................................................................160
A.5 Tools for Processing XML............................................................................................................163
A.6 Is That All There Is?.....................................................................................................................164
Appendix B. The HTTP You Need for XML−RPC.....................................................................................165
B.1 A Bit About TCP/IP......................................................................................................................165
B.2 HTTP at the Start of the Web........................................................................................................166
B.3 Adding Two−Way Communications............................................................................................166
B.4 Making Two−Way Communications Efficient.............................................................................172
B.5 Making the Infrastructure Do Something Different......................................................................172
B.6 Infrastructure Details.....................................................................................................................173
ii
Foreword
My name is Dave Winer. I wear a lot of hats. I'm the CEO of a company, a programmer, a columnist, a
weblogger, and a developer of things that turn into standards. The last role was the biggest surprise. I've been
developing software since the late 1970s, and all the time I wanted most to create a standardto develop
something that's so compelling and simple that its goodness propels it to success. I'd say now, with
XML−RPC becoming such a widely adopted protocol, that it's happened. It's a strange feeling, for sure. Now,
three years after the publication of the initial spec, it's an interesting time to pause and reflect how we got
here, and then I'd like to offer some ideas for where we're going.
In 1998, my company, UserLand Software, had just finished porting Frontier from Macintosh to Windows.
Our software made extensive use of networking, so we had a problemwith two versions of the software, how
would they communicate? We could no longer use the networking software of one platform: Apple Events on
the Mac or DCOM on Windows. So we decided to use two standards of the Internet, XML and HTTP, to form
the communication protocol for our software. By February 1998, we had a deployed protocol for
Frontier−to−Frontier communication simply called RPC, and it worked pretty well.
As I often do, I wrote a public essay about this and offered to work with others. Usually, I make those offers
and no one responds. This time, I got a call from Bob Atkinson, who I knew from work we did with Microsoft
on COM in the early 1990s, and he asked if we would like work with them on XML−over−HTTP. I
remembered that it had been a lot of fun working with Bob in the past, so without hesitation, I said yes.
I flew up to Redmond, met with Bob, and met Mohsen Al−Ghosein (of Microsoft) and Don Box (of
Developmentor) for the first time. We sat in a conference room. I had a projected laptop. I opened Notepad
with an example call from our earlier protocol. As people expressed their ideas, I changed the example. It was
one of the most productive brainstorming sessions of my career.
When I got back to California, we set up a web site and a private mail list and got busy writing clients and
servers. That's when betty.userland.com came into existence (it's mentioned in the chapters of this book).
Mohsen wrote JavaScript code to call my server. We talked about it on the mail list. One day Mohsen called
and described a much more powerful serialization format. Until then, we had only been passing scalars, but
with Mohsen's idea, we could move much more complicated structures. We upgraded our implementations,
and a few hours later we were talking structs and arrays.
A few weeks into the process, I wanted to release the software to our users. It was already much more
powerful than what we were shipping. Wire protocols are a delicate area, and serious breakage would surely
happen if we waited much longer. So we forked a release, called it XML−RPC, and continued working with
Microsoft on what would become SOAP 1.1. But that's another story and another O'Reilly book. ;−>
As the book at hand, Programming Web Services with XML−RPC, explains so well, XML−RPC is XML over
HTTP, and a great way to develop Web Services. But there's actually more going on herethere's a
philosophy to XML−RPC that's different from other software projects. The philosophy is choice, and from
choice comes power, and, interestingly, a disclaimer of power.
In the past, your choice of development environment limited your power as a developer. If you chose to do
Java development, that meant, for the most part, that your code could only communicate with other Java
programs. The same was true of Microsoft and, in practical terms, many open source scripting environments.
However, when you build applications with XML−RPC as the connecting glue, all of a sudden you're not
locked in. If you want to switch from Java to Python, for example, you can do it gradually, one component at
a time. This kind of fluidity allows developers more choices and relieves platform developers of the
responsibility of being all things to all people. By supporting XML−RPC, the platform is offering you a way
out if you don't like the way they're going. Choice here is power for developers.
We've learned the lessons from lock−in; XML−RPC takes it the next stepwhere it's supported, you are
guaranteed choice.
Having XML−RPC in place also means that new environments can come along, and even if they don't wipe
out all previous environments (they never do, of course), they can still find a user base that appreciates their
qualities, and their work can interoperate with the larger environment.
Viewed another way, XML−RPC turns the Internet itself into a scripting environment, much as Visual Basic
turned Windows into a scripting environment and AppleScript turned the Macintosh OS into one. It makes our
worlds come togethermakes the bigger world smaller and more approachable. And it's inclusive; no one need
be left out of the XML−RPC revolution.
And you can pick it up by a different thread, and it's one of the most ambitious and successful open source
projects in history. Most of the XML−RPC implementations are open source. Leaders of the open source
world, from Eric S. Raymond to Tim O'Reilly, are big fans of XML−RPC. The Slashdot guys love it. Why?
Because it's simple, low tech, and it gives developers freedom to choose their development environment.
The joy of XML−RPC for the programmer and designer is that we can learn how other people do what we do.
I know almost nothing about the non−UserLand implementations, yet my software is part of the network
defined by all the languages that support XML−RPC. It's like visiting a foreign country where they don't
speak your language. They still eat and sleep and do all the other things we all do, but they do it differently.
It's a passport that takes you anywhere you want to go.
So in my humble opinion, XML−RPC the ultimate leveler. It teaches us about each other. It's what we have in
common. Perl, Python, Tcl, C++, Java, Microsoft, Sun, O'Reilly, sole proprietors, LittleCo's and BigCo's,
open source teams, consultants and contractorseveryone can be on the bus; everyone can contribute to the
environment and benefit from it. Sure, it's also XML−over−HTTP, but it's also a ticket to freedom and power
for all developers. Looking toward the future, here's a list of issues that are on my mind (re: XML−RPC in
April 2001):
Applications
As we continue to work on interop, we're also creating public services in XML−RPC. For example,
our Manila content management system has a full XML−RPC interface, as does xmlStorageSystem
and mailToTheFuture. This means that every Manila site is a server that you can run XML−RPC
scripts against. There are so many cool things we can do here. The apps are linked into the Services
section of the XML−RPC directory. The list is relatively short nowone of our goals is to make the
list really big.
Tools
One of the most exciting possibilities of XML−RPC is that writing and illustration tools can
seamlessly connect to servers, turning the Web into a fantastic, easy, creative environment, open to
all.
Deployment
I'd like to see scripting environments bake XML−RPC into their releases. Networking is an important
function for all developers. UserLand has included full XML−RPC support in all of our products and
encourage others to do so, too.
Community
Please join the XML−RPC community. We have an active mail list and web site−all the resources are
pointed to from http://www.xmlrpc.com/.
XML−RPC is the work of many people. There were four designers working on the initial April 1998
2 Foreword
specification: Bob Atkinson and Mohsen Al−Ghosein of Microsoft, Don Box of Developmentor, and myself.
After that came implementors: people like Ken MacLeod, Fredrik Lundh, Hannes Wallnöfer, Edd Dumbill,
Eric Kidd, and many others. Thanks to these people, as well as those who have followed them: application
developers and people who have built networks and companies on XML−RPC.
Finally, thanks to O'Reilly for supporting the XML−RPC community with such an excellent book. And thanks
to Simon St.Laurent, Joe Johnston, and Edd Dumbill, for studying, understanding, and documenting
XML−RPC in the depth they have. Such commitment and talent is rare. We're really lucky to have them
working to make XML−RPC more broadly accessible to Internet developers.
Now I turn you over to their capable hands. I hope you enjoy XML−RPC and join the community, and let's
use XML−RPC to create a fantastic new Internet scripting environment.
Dave Winer
UserLand Software
April 2001
Foreword 3
剩余175页未读,继续阅读
资源评论
lsw_ruc
- 粉丝: 1
- 资源: 49
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功