www.it-ebooks.info www.it-ebooks.info WINDOWS AZURE ® MOBILE SERVICES INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv CHAPTER 1 Introduction and Fundamental Concepts . . . . . . . . . . . . . . . . . . . . . . 1 CHAPTER 2 Creating and Manipulating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 CHAPTER 3 Mobile Services Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 CHAPTER 4 Authentication Options in WAMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 CHAPTER 5 Using REST to Access WAMS Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 CHAPTER 6 Push Notifi cations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 CHAPTER 7 Advanced Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 CHAPTER 8 Advanced Confi guration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 www.it-ebooks.info www.it-ebooks.info Windows Azure ® Mobile Services www.it-ebooks.info www.it-ebooks.info Windows Azure ® Mobile Services Bruce Johnson www.it-ebooks.info Windows Azure ® Mobile Services Published by John Wiley & Sons, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2013 by John Wiley & Sons, Inc., Indianapolis, Indiana ISBN: 978-1-118-67853-4 (ebk) ISBN: 978-1-118-74991-3 (ebk) Manufactured in the United States of America No part of this publication may be reproduced, stored in a retrieval system or transmi ed in any form or by any means, elec- tronic, mechanical, photocopying, recording, scanning or otherwise, except as permi ed under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior wri en permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/ permissions. Limit of Liability/Disclaimer of Warranty: e publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or promotional materials. e advice and strategies contained herein may not be suitable for every situation. is work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages aris- ing herefrom. e fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was wri en and when it is read. For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other countries, and may not be used without wri en permission. Windows Azure is a registered trademark of Microso Corporation. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book. ACQUISITIONS EDITOR Mary James PROJECT EDITOR Edward Connor TECHNICAL EDITOR Wouter van Eck PRODUCTION EDITOR Christine Mugnolo COPY EDITOR Kim Cofer EDITORIAL MANAGER Mary Beth Wakefi eld FREELANCE EDITORIAL MANAGER Rosemarie Graham ASSOCIATE DIRECTOR OF MARKETING David Mayhew MARKETING MANAGER Ashley Zurcher VICE PRESIDENT AND EXECUTIVE GROUP PUBLISHER Richard Swadley VICE PRESIDENT AND EXECUTIVE PUBLISHER Neil Edde ASSOCIATE PUBLISHER Jim Minatel PROOFREADER James Saturnio, Word One New York COVER DESIGNER Ryan Sneed www.it-ebooks.info I’d like to thank my wife, Ali, and my four children, Curtis, Gillian, Cameron, and Kyle, for their love and support. ࡍ ey patiently put up with my lack of time whenever I tackle a book project, and for that I am truly grateful. And this time around, I have to include Hershey in the dedication. So say my kids . . . and what they say goes . – Bruce Johnson. www.it-ebooks.info ABOUT THE AUTHOR BRUCE JOHNSONɄis a partner at ObjectSharp Consulting and a 30-year veteran of the computer industry. ॡ e fi rst third of his career was spent doing “real work,” otherwise known as coding in the UNIX world. But for almost 20 years, he has been working on projects that are at the leading edge of Windows technology, from C++ through Visual Basic to C#, and from thick client applications to websites to services. As well as having fun with building systems, Bruce has spoken hundreds of times at conferences andbuser groups throughout North America. He has been a Microso॑ Certifi ed Trainer (MCT) for the past three years and he is a co-president of the Metro Toronto .NET User Group. He has wri॔ enbcolumns and articles for numerous magazines. While the quantity of the posts on his blog ( http://www.objectsharp.com/blogs/bruce) have decreased recently, the activity on his Twi॔ er account ( http://www.twitter.com/lacanuck) has shown a corresponding increase. For all of thisbactivity (or, perhaps, in spite of it), Bruce has been privileged to be recognized as a Microso॑ MVP for the past six years. ABOUT THE TECHNICAL EDITOR WOUTER VAN ECKɄis a so॑ ware design and development consultant specializing in cloud integration with a strong focus on the Microso॑ platform. In the past fi ve years or so, Wouter has focused on what we now call “the cloud” as the base for integration work backed by the Microso॑ Azure technology. With successful deployments in Canada, the United States, Germany, and Singapore, Wouter has demonstrated true cloud experience. www.it-ebooks.info [...]... Azure To create your mobile service, look for the Mobile Services icon and click it 9 www.it-ebooks.info CHAPTER 1 INTRODUCTION AND FUNDAMENTAL CONCEPTS At the time of writing, Windows Azure Mobile Services was still in preview mode So if you can’t find the Mobile Services icon, you need to activate the feature first Navigate to https:// account.windowsazure.com/PreviewFeatures, locate the Mobile Services. .. the Windows Azure series of books that is published by Wiley) is to change that perception By presenting a soup-to-nuts look at what Windows Azure Mobile Services (WAMS) has to offer, the goal is to provide you with enough information to either start using it immediately, or to put it into your development toolbox WHO THIS BOOK IS FOR Windows Azure Mobile Services is for any developer who is new to Windows. .. answering any questions I had — Bruce Johnson www.it-ebooks.info www.it-ebooks.info CONTENTS INTRODUCTION TO THE WINDOWS AZURE BOOK SERIES INTRODUCTION TO WINDOWS AZURE MOBILE SERVICES CHAPTER 1: INTRODUCTION AND FUNDAMENTAL CONCEPTS What Is Azure? xv xvii 1 2 A Brief History of Azure 2 Windows Azure Features 3 Execution Model Data Storage Connectivity Authentication Messaging 3 5 6 7 8 And Now, Back to... Services by Bruce Johnson, MVP, Partner, ObjectSharp Consulting ➤ Windows Azure Web Sites by James Chambers, Product & Community Development Manager, LogiSense www.it-ebooks.info INTRODUCTION TO THE WINDOWS AZURE BOOK SERIES ➤ Windows Azure Data Storage Simon Hart, So ware Architect, Microso ➤ Windows Azure Hybrid Cloud by Danny Garber, Windows Azure Solution Architect, Microso; Jamal Malik, Business Solution... information you need to put Windows Azure to use for you But as you continue to look to other Azure components to add to your infrastructure, don’t forget to check out the other books in the series to see what topics might be helpful e books in the series are: ➤ Windows Azure and ASP.NET MVC Migration by Benjamin Perkins, Senior Support Escalation Engineer, Microso ➤ Windows Azure Mobile Services by Bruce... platforms, you might find the classes provided by the SDK useful You can download the SDKs from http://www.windowsazure.com/en-us/ downloads xviii www.it-ebooks.info INTRODUCTION TO WINDOWS AZURE MOBILE SERVICES Along with these tools, you also need to have a Windows Azure account in order to create your mobile service You can find the necessary steps to get a trial account (presuming you don’t already have... Introduction and Fundamental Concepts IN THIS CHAPTER: ➤ Learn how Windows Azure evolved from its early days as a moderately useful product to become the collection of services that form the heart of Microsoft’s online functionality ➤ Understand the different products and services that exist under the Windows Azure banner ➤ Create your first Windows Azure Mobile Service e concept of “cloud computing” has taken... one topic As you go further into Azure, you can pick and choose what makes sense for you from the other books that are available Constructing your knowledge using these books is like building blocks Which is just the same manner that Azure was designed Bruce Johnson Azure Book Series Editor xvi www.it-ebooks.info INTRODUCTION TO WINDOWS AZURE MOBILE SERVICES WINDOWS AZURE has had a brief, yet interesting... Directory domain? Even that is easily within reach WHAT IS AZURE? From that brief introduction, it’s readily apparent that a number of components make up Windows Azure is section discusses where Azure has come from and what the pieces of Azure actually are A Brief History of Azure It all started in a small 5000-wa radio station… No, that’s not it Windows Azure was first announced at PDC 2008 Initially, it... through Windows Azure eues ough it is not exclusively an Azure concept (and that should not be a surprise to you), queues do form the backbone of the computational elements in Cloud Services eues are used to pass messages between the Web and Worker roles, which fits nicely into the scalability model that Cloud Services supports Service Bus e Windows Azure Service Bus performs a function similar to Windows . 126 www.it-ebooks.info www.it-ebooks.info Windows Azure ® Mobile Services www.it-ebooks.info www.it-ebooks.info Windows Azure ® Mobile Services Bruce Johnson www.it-ebooks.info Windows Azure ® Mobile Services Published. THE WINDOWS AZUREbBOOK SERIES xv INTRODUCTION TO WINDOWS AZURE MOBILE SERVICES xvii CHAPTER 1: INTRODUCTION AND FUNDAMENTAL CONCEPTS 1 What Is Azure? 2 A Brief History of Azure 2 Windows Azure. is just the same manner that Azure was designed. Bruce Johnson Azure Book Series Editor www.it-ebooks.info INTRODUCTION TO WINDOWS AZURE MOBILE SERVICES WINDOWS AZURE has had a brief, yet interesting