4339c00.qxd 5/25/04 5:10 PM Page iii John Paul Mueller (cid:1) Mining eBay®Web Services: Building Applications with the eBay API Sybex San Francisco • London 4339c00.qxd 5/25/04 5:10 PM Page iv 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 v SOFTWARE LICENSE AGREEMENT: Warranty TERMSAND CONDITIONS SYBEX warrants the enclosed media to be free of physical defects for a period of ninety (90) days after purchase. The Software is not The media and/or any online materials accompanying this book available from SYBEX in any other form or media than that enclosed that are available now or in the future contain programs and/or herein or posted to www.sybex.com. If you discover a defect in the text files (the “Software”) to be used in connection with the book. media during this warranty period, you may obtain a replacement SYBEX hereby grants to you a license to use the Software, subject of identical format at no charge by sending the defective media, to the terms that follow. Your purchase, acceptance, or use of the postage prepaid, with proof of purchase to: Software will constitute your acceptance of such terms. The Software compilation is the property of SYBEX unless other- SYBEX Inc. wise indicated and is protected by copyright to SYBEX or other Product Support Department copyright owner(s) as indicated in the media files (the “Owner(s)”). 1151 Marina Village Parkway You are hereby granted a single-user license to use the Software Alameda, CA 94501 for your personal, noncommercial use only. You may not repro- Web: http://www.sybex.com duce, sell, distribute, publish, circulate, or commercially exploit the Software, or any portion thereof, without the written consent After the 90-day period, you can obtain replacement media of of SYBEX and the specific copyright owner(s) of any component identical format by sending us the defective disk, proof of purchase, software included on this media. and a check or money order for $10, payable to SYBEX. In the event that the Software or components include specific Disclaimer license requirements or end-user agreements, statements of condi- SYBEX makes no warranty or representation, either expressed or tion, disclaimers, limitations or warranties (“End-User License”), implied, with respect to the Software or its contents, quality, per- those End-User Licenses supersede the terms and conditions herein formance, merchantability, or fitness for a particular purpose. In as to that particular Software component. Your purchase, acceptance, no event will SYBEX, its distributors, or dealers be liable to you or or use of the Software will constitute your acceptance of such End- any other party for direct, indirect, special, incidental, consequen- User Licenses. tial, or other damages arising out of the use of or inability to use By purchase, use or acceptance of the Software you further agree the Software or its contents even if advised of the possibility of to comply with all export laws and regulations of the United States such damage. In the event that the Software includes an online as such laws and regulations may exist from time to time. update feature, SYBEX further disclaims any obligation to provide this feature for any specific duration other than the initial posting. Reusable Code in This Book The exclusion of implied warranties is not permitted by some states. The author(s) created reusable code in this publication expressly for Therefore, the above exclusion may not apply to you. This war- reuse by readers. Sybex grants readers limited permission to reuse ranty provides you with specific legal rights; there may be other the code found in this publication, its accompanying CD-ROM or rights that you may have that vary from state to state. The pricing available for download from our website so long as the author(s) of the book with the Software by SYBEX reflects the allocation are attributed in any application containing the reusable code and of risk and limitations on liability contained in this agreement of the code itself is never distributed, posted online by electronic Terms and Conditions. transmission, sold, or commercially exploited as a stand-alone product. Shareware Distribution This Software may contain various programs that are distributed Software Support as shareware. Copyright laws apply to both shareware and ordinary Components of the supplemental Software and any offers associ- commercial software, and the copyright Owner(s) retains all rights. ated with them may be supported by the specific Owner(s) of that If you try a shareware program and continue using it, you are material, but they are not supported by SYBEX. Information expected to register it. Individual programs differ on details of trial regarding any available support may be obtained from the periods, registration, and payment. Please observe the requirements Owner(s) using the information provided in the appropriate stated in appropriate files. read.me files or listed elsewhere on the media. Copy Protection Should the manufacturer(s) or other Owner(s) cease to offer sup- The Software in whole or in part may or may not be copy-pro- port or decline to honor any offer, SYBEX bears no responsibility. tected or encrypted. However, in all cases, reselling or redistribut- This notice concerning support for the Software is provided for ing these files without authorization is expressly forbidden except your information only. SYBEX is not the agent or principal of the as specifically provided for by the Owner(s) therein. 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). 4339c00.qxd 5/25/04 5:10 PM Page vii 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 ix 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 x 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 xi 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 xii 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 xiii 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
Description: