jakarta, sep 29, 2011




work with Windows Azure
   from mobile platforms




Andri Yadi
andri (at) dycode (dot) com
@andri_yadi
about me
4 years in a row
start my own company & code for food
8 years in mobile development
a movie freak
the ceo of
i won’t talk much about Azure,
   but mostly on client side
azure?
use cloud as storage
(blob + structured data)
access web applications
hosted in azure
receive notifications
work with azure from mobile
 client apps can be complex
scenario 1




       table storage

http



       blob storage
you need to create storage, then
remember the account name & key
REST Endpoint:
http://[account].blob.core.windows.net

•List, Create, and Delete Containers
•List, Put, Get, Delete Blobs




                          blob storage
list all blob containers
GET	
  http://watiosdemo.blob.core.windows.net/?comp=list&include=metadata

x-­‐ms-­‐date:	
  Thu,	
  14	
  Apr	
  2011	
  20:30:00	
  GMT
x-­‐ms-­‐version:	
  2009-­‐09-­‐19
x-­‐ms-­‐blob-­‐type:	
  BlockBlob
Authorization:	
  SharedKey	
  watiosdemo:[ComputedHash]




                                                 blob storage
compute hash



AccountKey:	
  /9seXadQ9HwOpXUO1jKxFN8q…

Request:	
  GETnnnnnnnnnnnnx-­‐ms-­‐blob-­‐type:BlockBlobnx-­‐ms-­‐
date:Thu,	
  14	
  Apr	
  2011	
  20:30:00	
  GMTnx-­‐ms-­‐version:2009-­‐09-­‐19n/
watiosdemo/ncomp:listninclude:metadata


Hash = HMACSHA256(UTF8Encode(Request), Base64Decode(AccountKey))
list all blob containers
GET	
  http://watiosdemo.blob.core.windows.net/?comp=list&include=metadata

x-­‐ms-­‐date:	
  Thu,	
  14	
  Apr	
  2011	
  20:30:00	
  GMT
x-­‐ms-­‐version:	
  2009-­‐09-­‐19
x-­‐ms-­‐blob-­‐type:	
  BlockBlob
Authorization:	
  SharedKey	
  watiosdemo:[ComputedHash]




 <?xml	
  version="1.0"	
  encoding="utf-­‐8"?>
 <EnumerationResults	
  AccountName="http://watiosdemo.blob.core.windows.net/">

                                                                 blob storage
 	
  	
  <Prefix>c</Prefix>
 	
  	
  <MaxResults>3</MaxResults>
 	
  	
  <Containers>
 	
  	
  	
  	
  <Container>
 	
  	
  	
  	
  	
  	
  <Name>movieposter</Name>
 	
  	
  	
  	
  	
  	
  <Url>http://watiosdemo.blob.core.windows.net/movieposter</Url>
 	
  	
  	
  	
  	
  	
  <Properties>
 	
  	
  	
  	
  	
  	
  	
  	
  <Last-­‐Modified>Sun,	
  14	
  Apr	
  2011	
  20:09:03	
  GMT</Last-­‐Modified>
 	
  	
  	
  	
  	
  	
  </Properties>
 	
  	
  	
  	
  </Container>
 	
  	
  </Containers>
 ....
add new image
PUT	
  http://watiosdemo.blob.core.windows.net/movieposter/poster.jpg	
  

x-­‐ms-­‐date:	
  Thu,	
  14	
  Apr	
  2011	
  20:30:00	
  GMT
x-­‐ms-­‐version:	
  2009-­‐09-­‐19
x-­‐ms-­‐blob-­‐type:	
  BlockBlob
Authorization:	
  SharedKey	
  watiosdemo:[ComputedHash]

{...binary	
  representation	
  of	
  image...}




                                            blob storage
REST Endpoint:
http://[account].table.core.windows.net

•List, Create, and Delete Tables
•List, Put, Get, Delete Table Entities




                            table storage
list all tables
GET	
  http://watiosdemo.table.core.windows.net/Tables

x-­‐ms-­‐date:	
  Thu,	
  14	
  Apr	
  2011	
  20:30:00	
  GMT
x-­‐ms-­‐version:	
  2009-­‐09-­‐19
DataServiceVersion:	
  1.0;NetFx
MaxDataServiceVersion:	
  2.0;NetFx
Authorization:	
  SharedKey	
  watiosdemo:[ComputedHash]




 <feed	
  xml:base="http://iostest.tables.core.windows.net/"	
  xmlns:d="http://
 schemas.microsoft.com/ado/2007/08/dataservices"	
  xmlns:m="http://
 schemas.microsoft.com/ado/2007/08/dataservices/metadata"	
  xmlns="http://
 www.w3.org/2005/Atom">
 	
  	
  <title	
  type="text">Tables</title>
                                                 blob storage
 	
  	
  <id>http://watiosdemo.tables.core.windows.net/Tables</id>
 	
  	
  <updated>2011-­‐04-­‐04T17:18:54.7062347Z</updated>
 	
  	
  <link	
  rel="self"	
  title="Tables"	
  href="Tables"	
  />
 	
  	
  <entry>
 	
  	
  	
  	
  <id>http://watiosdemo.tables.core.windows.net/Tables(‘movie')</id>
 	
  	
  	
  	
  <title	
  type="text"></title>
 	
  	
  	
  	
  <updated>2009-­‐01-­‐04T17:18:54.7062347Z</updated>
 	
  	
  	
  	
  <author>
 	
  	
  	
  	
  	
  	
  <name	
  />
 	
  	
  	
  	
  </author>
 ....
it’s hard, right?
     luckily...
there’re toolkits for popular
                               mobile platforms

           iOS toolkit



android
 toolkit




           wp7 toolkit
windows azure toolkit
           for windows phone 7

encapsulates authentication
(directly or through proxy)

requests & responses abstraction
for cloud storage & SQL Azure

supports both Apple push
notification & MS push notification

source code is available at:
https://watwp.codeplex.com


latest version 1.3.0, sep 30, 2011
windows azure toolkit
                         for iOS

encapsulates authentication
(directly or through proxy)

requests & responses abstraction
for cloud storage

supports Apple push notification

source code is available at:
https://github.com/microsoft-dpe/wa-toolkit-ios


latest version 1.2.1, aug 31, 2011
windows azure toolkit
                     for android

encapsulates authentication
(directly or through proxy)

requests & responses abstraction
for cloud storage

source code is available at:
https://github.com/microsoft-dpe/wa-toolkit-android


latest version 0.8, aug 31, 2011
demo
we do apps for all mobile platforms
our mobile apps portfolios
our mobile apps portfolios

Work with Windows Azure from Mobile Apps

  • 1.
    jakarta, sep 29,2011 work with Windows Azure from mobile platforms Andri Yadi andri (at) dycode (dot) com @andri_yadi
  • 2.
  • 3.
  • 4.
    start my owncompany & code for food
  • 5.
    8 years inmobile development
  • 6.
  • 7.
  • 8.
    i won’t talkmuch about Azure, but mostly on client side
  • 9.
  • 10.
    use cloud asstorage (blob + structured data) access web applications hosted in azure receive notifications
  • 11.
    work with azurefrom mobile client apps can be complex
  • 12.
    scenario 1 table storage http blob storage
  • 13.
    you need tocreate storage, then remember the account name & key
  • 14.
    REST Endpoint: http://[account].blob.core.windows.net •List, Create,and Delete Containers •List, Put, Get, Delete Blobs blob storage
  • 15.
    list all blobcontainers GET  http://watiosdemo.blob.core.windows.net/?comp=list&include=metadata x-­‐ms-­‐date:  Thu,  14  Apr  2011  20:30:00  GMT x-­‐ms-­‐version:  2009-­‐09-­‐19 x-­‐ms-­‐blob-­‐type:  BlockBlob Authorization:  SharedKey  watiosdemo:[ComputedHash] blob storage
  • 16.
    compute hash AccountKey:  /9seXadQ9HwOpXUO1jKxFN8q… Request:  GETnnnnnnnnnnnnx-­‐ms-­‐blob-­‐type:BlockBlobnx-­‐ms-­‐ date:Thu,  14  Apr  2011  20:30:00  GMTnx-­‐ms-­‐version:2009-­‐09-­‐19n/ watiosdemo/ncomp:listninclude:metadata Hash = HMACSHA256(UTF8Encode(Request), Base64Decode(AccountKey))
  • 17.
    list all blobcontainers GET  http://watiosdemo.blob.core.windows.net/?comp=list&include=metadata x-­‐ms-­‐date:  Thu,  14  Apr  2011  20:30:00  GMT x-­‐ms-­‐version:  2009-­‐09-­‐19 x-­‐ms-­‐blob-­‐type:  BlockBlob Authorization:  SharedKey  watiosdemo:[ComputedHash] <?xml  version="1.0"  encoding="utf-­‐8"?> <EnumerationResults  AccountName="http://watiosdemo.blob.core.windows.net/"> blob storage    <Prefix>c</Prefix>    <MaxResults>3</MaxResults>    <Containers>        <Container>            <Name>movieposter</Name>            <Url>http://watiosdemo.blob.core.windows.net/movieposter</Url>            <Properties>                <Last-­‐Modified>Sun,  14  Apr  2011  20:09:03  GMT</Last-­‐Modified>            </Properties>        </Container>    </Containers> ....
  • 18.
    add new image PUT  http://watiosdemo.blob.core.windows.net/movieposter/poster.jpg   x-­‐ms-­‐date:  Thu,  14  Apr  2011  20:30:00  GMT x-­‐ms-­‐version:  2009-­‐09-­‐19 x-­‐ms-­‐blob-­‐type:  BlockBlob Authorization:  SharedKey  watiosdemo:[ComputedHash] {...binary  representation  of  image...} blob storage
  • 19.
    REST Endpoint: http://[account].table.core.windows.net •List, Create,and Delete Tables •List, Put, Get, Delete Table Entities table storage
  • 20.
    list all tables GET  http://watiosdemo.table.core.windows.net/Tables x-­‐ms-­‐date:  Thu,  14  Apr  2011  20:30:00  GMT x-­‐ms-­‐version:  2009-­‐09-­‐19 DataServiceVersion:  1.0;NetFx MaxDataServiceVersion:  2.0;NetFx Authorization:  SharedKey  watiosdemo:[ComputedHash] <feed  xml:base="http://iostest.tables.core.windows.net/"  xmlns:d="http:// schemas.microsoft.com/ado/2007/08/dataservices"  xmlns:m="http:// schemas.microsoft.com/ado/2007/08/dataservices/metadata"  xmlns="http:// www.w3.org/2005/Atom">    <title  type="text">Tables</title> blob storage    <id>http://watiosdemo.tables.core.windows.net/Tables</id>    <updated>2011-­‐04-­‐04T17:18:54.7062347Z</updated>    <link  rel="self"  title="Tables"  href="Tables"  />    <entry>        <id>http://watiosdemo.tables.core.windows.net/Tables(‘movie')</id>        <title  type="text"></title>        <updated>2009-­‐01-­‐04T17:18:54.7062347Z</updated>        <author>            <name  />        </author> ....
  • 21.
  • 22.
    there’re toolkits forpopular mobile platforms iOS toolkit android toolkit wp7 toolkit
  • 23.
    windows azure toolkit for windows phone 7 encapsulates authentication (directly or through proxy) requests & responses abstraction for cloud storage & SQL Azure supports both Apple push notification & MS push notification source code is available at: https://watwp.codeplex.com latest version 1.3.0, sep 30, 2011
  • 24.
    windows azure toolkit for iOS encapsulates authentication (directly or through proxy) requests & responses abstraction for cloud storage supports Apple push notification source code is available at: https://github.com/microsoft-dpe/wa-toolkit-ios latest version 1.2.1, aug 31, 2011
  • 25.
    windows azure toolkit for android encapsulates authentication (directly or through proxy) requests & responses abstraction for cloud storage source code is available at: https://github.com/microsoft-dpe/wa-toolkit-android latest version 0.8, aug 31, 2011
  • 26.
  • 28.
    we do appsfor all mobile platforms
  • 29.
    our mobile appsportfolios
  • 30.
    our mobile appsportfolios