Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Mining eBay web services
PREMIUM
Số trang
430
Kích thước
6.8 MB
Định dạng
PDF
Lượt xem
710

Mining eBay web services

Nội dung xem thử

Mô tả chi tiết

 Mining eBay Web Services:

Building Applications with the eBay API

4339c00.qxd 5/25/04 5:10 PM Page i

4339c00.qxd 5/25/04 5:10 PM Page ii

John Paul Mueller

 Mining eBay Web Services:

Building Applications with the eBay API

San Francisco • London

Sybex

®

4339c00.qxd 5/25/04 5:10 PM Page iii

Associate Publisher: Joel Fugazzotto

Acquisitions and Developmental Editor: Tom Cirtin

Production Editor: Leslie E.H. Light

Technical Editor: Russ Mullen

Copyeditor: Cheryl Hauser

Compositor: Happenstance Type-O-Rama

Graphic Illustrator: Happenstance Type-O-Rama

Proofreaders: Laurie O’Connell, Nancy Riddiough

Indexer: Lynnzee Elze

Cover Design and Illustration: Richard Miller, Calyx Design

Copyright © 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights reserved. No part of this publication may

be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph, magnetic, or

other record, without the prior agreement and written permission of the publisher.

Library of Congress Card Number: 2004104104

ISBN: 0-7821-4339-3

SYBEX and the SYBEX logo are either registered trademarks or trademarks of SYBEX Inc. in the United States and/or other countries.

Screen reproductions produced with PaintShop Pro. PaintShop Pro is a trademark of Jasc Software, Inc.

Internet screen shot(s) using Microsoft Internet Explorer reprinted by permission from Microsoft Corporation.

Openwave and the Openwave logo are trademarks of Openwave Systems Inc. All rights reserved.

TRADEMARKS: SYBEX has attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following

the capitalization style used by the manufacturer.

eBay and the eBay logo are trademarks of eBay Inc. All rights reserved.

The author and publisher have made their best efforts to prepare this book, and the content is based upon final release software whenever

possible. Portions of the manuscript may be based upon pre-release versions supplied by software manufacturer(s). The author and the pub￾lisher make no representation or warranties of any kind with regard to the completeness or accuracy of the contents herein and accept no

liability of any kind including but not limited to performance, merchantability, fitness for any particular purpose, or any losses or damages

of any kind caused or alleged to be caused directly or indirectly from this book.

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

4339c00.qxd 5/25/04 5:10 PM Page iv

SOFTWARE LICENSE AGREEMENT:

TERMS AND CONDITIONS

The media and/or any online materials accompanying this book

that are available now or in the future contain programs and/or

text files (the “Software”) to be used in connection with the book.

SYBEX hereby grants to you a license to use the Software, subject

to the terms that follow. Your purchase, acceptance, or use of the

Software will constitute your acceptance of such terms.

The Software compilation is the property of SYBEX unless other￾wise indicated and is protected by copyright to SYBEX or other

copyright owner(s) as indicated in the media files (the “Owner(s)”).

You are hereby granted a single-user license to use the Software

for your personal, noncommercial use only. You may not repro￾duce, sell, distribute, publish, circulate, or commercially exploit

the Software, or any portion thereof, without the written consent

of SYBEX and the specific copyright owner(s) of any component

software included on this media.

In the event that the Software or components include specific

license requirements or end-user agreements, statements of condi￾tion, disclaimers, limitations or warranties (“End-User License”),

those End-User Licenses supersede the terms and conditions herein

as to that particular Software component. Your purchase, acceptance,

or use of the Software will constitute your acceptance of such End￾User Licenses.

By purchase, use or acceptance of the Software you further agree

to comply with all export laws and regulations of the United States

as such laws and regulations may exist from time to time.

Reusable Code in This Book

The author(s) created reusable code in this publication expressly for

reuse by readers. Sybex grants readers limited permission to reuse

the code found in this publication, its accompanying CD-ROM or

available for download from our website so long as the author(s)

are attributed in any application containing the reusable code and

the code itself is never distributed, posted online by electronic

transmission, sold, or commercially exploited as a stand-alone

product.

Software Support

Components of the supplemental Software and any offers associ￾ated with them may be supported by the specific Owner(s) of that

material, but they are not supported by SYBEX. Information

regarding any available support may be obtained from the

Owner(s) using the information provided in the appropriate

read.me files or listed elsewhere on the media.

Should the manufacturer(s) or other Owner(s) cease to offer sup￾port or decline to honor any offer, SYBEX bears no responsibility.

This notice concerning support for the Software is provided for

your information only. SYBEX is not the agent or principal of the

Owner(s), and SYBEX is in no way responsible for providing any

support for the Software, nor is it liable or responsible for any sup￾port provided, or not provided, by the Owner(s).

Warranty

SYBEX warrants the enclosed media to be free of physical defects

for a period of ninety (90) days after purchase. The Software is not

available from SYBEX in any other form or media than that enclosed

herein or posted to www.sybex.com. If you discover a defect in the

media during this warranty period, you may obtain a replacement

of identical format at no charge by sending the defective media,

postage prepaid, with proof of purchase to:

SYBEX Inc.

Product Support Department

1151 Marina Village Parkway

Alameda, CA 94501

Web: http://www.sybex.com

After the 90-day period, you can obtain replacement media of

identical format by sending us the defective disk, proof of purchase,

and a check or money order for $10, payable to SYBEX.

Disclaimer

SYBEX makes no warranty or representation, either expressed or

implied, with respect to the Software or its contents, quality, per￾formance, merchantability, or fitness for a particular purpose. In

no event will SYBEX, its distributors, or dealers be liable to you or

any other party for direct, indirect, special, incidental, consequen￾tial, or other damages arising out of the use of or inability to use

the Software or its contents even if advised of the possibility of

such damage. In the event that the Software includes an online

update feature, SYBEX further disclaims any obligation to provide

this feature for any specific duration other than the initial posting.

The exclusion of implied warranties is not permitted by some states.

Therefore, the above exclusion may not apply to you. This war￾ranty provides you with specific legal rights; there may be other

rights that you may have that vary from state to state. The pricing

of the book with the Software by SYBEX reflects the allocation

of risk and limitations on liability contained in this agreement of

Terms and Conditions.

Shareware Distribution

This Software may contain various programs that are distributed

as shareware. Copyright laws apply to both shareware and ordinary

commercial software, and the copyright Owner(s) retains all rights.

If you try a shareware program and continue using it, you are

expected to register it. Individual programs differ on details of trial

periods, registration, and payment. Please observe the requirements

stated in appropriate files.

Copy Protection

The Software in whole or in part may or may not be copy-pro￾tected or encrypted. However, in all cases, reselling or redistribut￾ing these files without authorization is expressly forbidden except

as specifically provided for by the Owner(s) therein.

4339c00.qxd 5/25/04 5:10 PM Page v

4339c00.qxd 5/25/04 5:10 PM Page vi

This book is dedicated to Matt Wagner—a source

of encouragement in troubled times and a voice of

reason when things go wrong, a friend in

weather foul and fair.

4339c00.qxd 5/25/04 5:10 PM Page vii

4339c00.qxd 5/25/04 5:10 PM Page viii

Acknowledgments

T

hanks to my wife, Rebecca, for working with me to get this book completed. I really don’t

know what I would have done without her help in researching and compiling some of the

information that appears in this book. She also did a fine job of proofreading my rough draft

and page proofing the result.

Russ Mullen deserves thanks for his technical edit of this book. He greatly added to the

accuracy and depth of the material you see here. Russ is always providing me with great URLs

for new products and ideas. I also appreciated his hard work in testing endless versions of

applications and providing input in my ideas. This book is technically challenging in that it

relies on a number of programming languages, new and evolving technology, and several new

products. Russ met the challenge with an efficiency that few other people could match.

eBay was very helpful in putting this book together. I don’t know everyone from eBay who

worked on this book, but I can thank those that I do know by name. Gary Downing made

many introductions and acted as eBay’s ambassador for the book. Michael Knopp provided a

great many helpful comments and personal insights into eBay. I know that the book is much

better for all of the help I received from these and other individuals from eBay.

A number of people read all or part of this book to help me refine the approach and to test

the examples on a number of systems. These unpaid volunteers helped in ways too numerous

to mention here. I especially appreciate the efforts of Eva Beattie who read the entire book

and selflessly devoted herself to this project. Mike and Jody Cummings of The Treasure Mill

provided me with training on using eBay in a real world business environment, helped me

understand some of the nuances of the bidding process, and generally provided their expertise

on a decidedly complex environment. Alessandro Vernet provided a variety of helpful tips

and hints. Osvaldo Téllez Almirall provided extensive input on international issues, making

the book much better suited to international needs as a result. David Clark helped with

accessibility, user interface, and PHP development issues.

Matt Wagner, my agent, deserves credit for helping me get the contract in the first place

and taking care of all the details that most authors don’t really consider. I always appreciate

his help. It’s good to know that someone wants to help.

Finally, I would like to thank Tom Cirtin, Leslie Light, Cheryl Hauser, and the rest of the

editorial and production staff at Sybex for their assistance in bringing this book to print. It’s

always nice to work with such a great group of professionals and I very much appreciate the

friendship we have built over the last three books.

4339c00.qxd 5/25/04 5:10 PM Page ix

Contents at a Glance

Introduction xx

Part I Discovering eBay Web Services 1

Chapter 1: Learning about eBay Web Services 3

Chapter 2: Using eBay Web Services to Your Advantage 25

Chapter 3: Defining a Search 47

Chapter 4: Working with Web Service Data 63

Part II Writing eBay Web Services Programs 95

Chapter 5: Starting the Development Process 97

Chapter 6: Writing Browser-Based Applications 121

Chapter 7: Writing Applications Using VBA 143

Chapter 8: Writing Applications Using Visual Studio 171

Chapter 9: Writing Applications Using PHP 215

Chapter 10: Writing Applications Using Java 239

Chapter 11: Writing Applications for Mobile Devices 261

Part III Refining Your eBay Web Services Program 281

Chapter 12: Crafting Your Application 283

Chapter 13: Considering User Needs 297

Chapter 14: Other Refinements You Should Consider 313

4339c00.qxd 5/25/04 5:10 PM Page x

Appendices

Appendix A: Helpful Third Party Resource Sites 331

Appendix B: eBay License Checklist 337

Appendix C: Late Breaking eBay Web Services News 345

Glossary 359

Index 381

4339c00.qxd 5/25/04 5:10 PM Page xi

Contents

Introduction xx

Part I Discovering eBay Web Services 1

Chapter 1 Learning about eBay Web Services 3

Understanding the eBay Web Services 4

What Is a Web Service? 4

How Do Web Services Work? 6

Considering the Usage Requirements 7

What Is Sandbox Mode? 9

Discovering Uses for the eBay Web Services 9

Buying Products 10

Selling and Relisting Products 10

Determining Product Facts 11

Discovering Product Payment and Shipping Methods 12

Giving and Receiving Feedback 12

Learning about a Store 13

Working with User Information 13

Performing Research 13

Creating an Offline Archive 14

Downloading and Installing the Kit 15

Determining Which Licensing Level Is Best 15

Becoming an eBay Developer Program Member 17

Obtaining Your License 18

Performing the Download 18

Installing the Kit 18

System Setup Considerations 20

Understanding Connectivity Requirements 20

Programming Setups for the Non-Developer 21

4339c00.qxd 5/25/04 5:10 PM Page xii

Contents ❘ xiii

Considering the User 22

Using Multiple Test Devices 23

Emulating the Real World 24

Your Call to Action 24

Chapter 2 Using eBay Web Services to Your Advantage 25

Knowing What to Expect As Output 26

Limitations of eBay Web Services Output 26

Making Sensible Queries 29

Defining Static and Dynamic Data 30

Understanding the Certification Requirements 31

Creating a Test User 32

Working in Sandbox Mode 34

Getting Your Application Certified 35

Working with Some Simple Examples 37

Understanding the Example Types 37

Using a Browser Example 38

Viewing the XSLT Example 39

Viewing the Desktop Example 40

Viewing the Pocket PC Example 41

Manipulating Data to Meet Specific Needs 42

Understanding Data Transformation Requirements 43

Viewing the eBay Examples 44

Using the PERL Example 44

Your Call to Action 46

Chapter 3 Defining a Search 47

Performing a Typical Search 48

Adding Search Conditions 50

Using an Advanced Search 50

Using Other Special Search Techniques 52

Considering the URL Search Form 55

Understanding the Developer Search Options 58

Changing the Presentation 59

Localizing the Information 60

Your Call to Action 60

4339c00.qxd 5/25/04 5:10 PM Page xiii

xiv ❘ Contents

Chapter 4 Working with Web Service Data 63

Understanding XML Basics 64

Defining the Parts of an XML Message 65

Viewing XML Data in Your Browser 66

Getting XML Data Tools 68

Sending Special Characters Using URL Encoding 72

Learning More about XML 75

Using XSLT for Presentation 76

Using a Script to Call an XSLT Page 76

Understanding How XSLT Works 78

Writing a Simple XSLT Page 80

Learning More about XSLT 81

Using the eBay API Test Tool 82

Creating Messages for eBay Using XML 86

Determining Where XML Fits into eBay Web Services 87

Understanding Privacy Issues 88

Privacy Required by the eBay License 89

General User Privacy 90

Understanding Security Issues 90

General Security Issues 90

Using SSL to Contact eBay 91

Security Required by the eBay License 91

Your Call to Action 92

Part II Writing eBay Web Services Programs 95

Chapter 5 Starting the Development Process 97

Choosing a Communication Method 99

Choosing between the API and SDK 99

Using XML over HTTPS 100

Using XSLT 101

Defining the Common Communication Elements 102

Getting a User Token 103

Selecting a Platform 109

Writing Desktop Applications 109

4339c00.qxd 5/25/04 10:19 PM Page xiv

Contents ❘ xv

Writing Small Form Factor Applications 112

Writing Mixed Environment Applications 114

Selecting a Development Language 115

Choosing a Language that Meets Specific Needs 115

Considering Your Skills and Abilities 116

Defining Language Limitations 116

Understanding Internationalization Issues 117

Learning the Limits of Translation 117

Considering the User’s Location 119

Using the SiteId to Your Advantage 119

Your Call to Action 119

Chapter 6 Writing Browser-Based Applications 121

Using JavaScript to Access eBay Web Services 122

Understanding the Basic Access Technique 123

Modifying the Basic Technique to Use XSLT 127

Modifying the Basic Technique to Perform Authentication 129

Performing a Category Search 136

Developing the Basic Category Search 136

Augmenting the Category Search with XSLT 139

Your Call to Action 140

Chapter 7 Writing Applications Using VBA 143

Understanding the Benefits of Using VBA 143

Resources for Learning VBA 144

Understanding Scripting of Web Services 145

An Alternative to VBA 145

Using the eBay API Test Tool to Authenticate a User 147

Using the Microsoft and eBay Examples 148

Developing with Microsoft Excel 154

Developing an Application with the SDK 155

Developing an Application with the API 160

Using Microsoft Access as a Database 164

Caching as a Practical Performance Enhancing Technique 165

Creating a Cached Application 166

Your Call to Action 169

4339c00.qxd 5/25/04 10:19 PM Page xv

Tải ngay đi em, còn do dự, trời tối mất!