Building Solutions on the Microsoft Platformthat target iPhone, iPad, and AndroidSimon GuestDirector, Mobility Solutionssimon.guest@neudesic.com
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)
www.comscore.com/Products_Services/Product_Index/MobiLens (trend used for Dec and Mar)WM6 loses 10% share in 12 months.  What will WP7 bring?RIM remains strong, but steadily eroding shareAndroid on fire.  From 2.8% to 28.7% in 12 monthsiOS holding steady around 25% market share
Many customers looking at building applications targeting iPhone, iPad, and Android devices
But what if you have an existing investment in Microsoft technology?
To give you the tools and knowledge to connect iPhone, iPad, and Android devicesto a Microsoft platform and infrastructure
“I’ve got an existing web site...”  “How do I make it render well on the iPhone and Android handsets?”
Step 1:  Need to identify mobile browsers
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)HTTP RequestHTTP ResponsePagesWindows 7 / IE8.0
UserAgent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5HTTP RequestHTTP ResponsePagesiPhone OS 4.2
Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.2.1 Mobile/7B334b Safari/531.21.10HTTP RequestHTTP ResponsePagesiPad OS 4.2
Mozilla/5.0 (Linux; U; Android 2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1HTTP RequestHTTP ResponsePagesAndroid 2.2
if (useragent contains ”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0Pagesif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1PagesAndroid 2.2
if (useragent contains ”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
if (useragent contains ”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
if (useragent contains ”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerASP.NET MVCViewEngineif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
Demo:  Implementing Mobile View Engines in ASP.NET MVC 3
“Errr…  OK – but it still looks like my original webpage”
User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerASP.NET MVCViewEngineMozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
Mobile Web FrameworksiUIhttp://iui-js.orgjQTouchhttp://jqtouch.comjQueryMobilehttp://jquerymobile.com
Device-Integrated Web FrameworksSencha Touchhttp://sencha.comUnifyhttp://unify.github.com/unifyPhoneGaphttp://phonegap.com
User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerASP.NET MVCViewEngineMozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.01. Copy SiteMasterintoMobileSiteMaster2. ImportjQueryMobileASP.NET MVCViewEngine3. Annotate structure of MobileSiteMasterMozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.14. Annotate individual viewsAndroid 2.2
Demo:  Using jQueryMobile to create device specific UI
TakeawaysRecommendations:Mobile Web sites will let you target multiple devices with a single back end
Use ASP.NET MVC with ViewEngine support for device specific views
Use ASP.NET MVC 3 (not 2) for improved HTML5 attributesWatch out for:Many different UI frameworks – choose carefully, think about longevity
MEAPs – Mobile Enterprise Application Platforms (auto gen’d UI from single source)
“We’ve covered Mobile Web pages, but how about if my site has REST/SOAP services?”
Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)SOAP (WS-I)Android 2.2 (Java)
Native ApplicationRESTREST.svc<%@ ServiceHost Service="TRMobile.Web.Services.SessionService" Factory="System.ServiceModel.Activation.WebServiceHostFactory"  %>iPad/iPhone OS 4.2 (ObjC)Android 2.2 (Java)
Native ApplicationSessionService.csRESTpublic class SessionService : ISessionService{public SessionSummary[] GetData(){// return active sessions    }} iPad/iPhone OS 4.2 (ObjC)Android 2.2 (Java)
Native ApplicationISessionService.csREST [ServiceContract]    public interface ISessionService    {[WebGet(UriTemplate = "/Sessions", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]        [OperationContract]SessionSummary[] GetData();    }iPad/iPhone OS 4.2 (ObjC)Android 2.2 (Java)
Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 1:  Youneed a JSON libraryhttp://stig.github.com
iPhoneClientViewController.m-(IBAction)callRESTService:(id)sender{	NSURL *url = [NSURL URLWithString:@"http://sguest01/TRMobile/Services/REST.svc/Sessions"];NSMutableURLRequest *request = [NSMutableURLRequestrequestWithURL:url];	[request setHTTPMethod:@"GET"];connection = [[NSURLConnectionalloc] initWithRequest:requestdelegate:self];	if (connection)	{NSLog(@"Connection was established");receivedData = [[NSMutableData data] retain];	}else {NSLog(@"Connection wasnull");	}}Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 2:  UseNSMutableURLRequest to call the service
iPhoneClientViewController.m- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{NSLog(@"Received response from the REST call");	[receivedData setLength:0];}-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{NSLog(@"Received data from the REST call");	[receivedDataappendData:data];}-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{NSLog(@"REST call failed with an error");}Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 3:  Handle callbacks
iPhoneClientViewController.m-(void)connectionDidFinishLoading:(NSURLConnection *)connection{NSLog(@"Connection finished loading");NSString *responseString = [[NSStringalloc]initWithData:receivedData encoding:NSUTF8StringEncoding];NSLog(@"%@",responseString);NSArray *dict = [responseStringJSONValue]; 	for (id obj in dict)	{NSDictionary *session = [[NSDictionaryalloc] initWithDictionary:obj];NSString *sessionCode = [session valueForKey:@"Code"];NSLog(@"%@",sessionCode);	}NSLog(@"Complete");}Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 4:  Get the response, deserialize JSON
Demo:  Consuming a REST based service on iPhone/iPad
“Great!  Is it a similar process on Android?”
Native ApplicationRESTMain.javaHttpClienthttpClient = new DefaultHttpClient();HttpGetrequest = new HttpGet("http://sguest01/TRMobile/Services/REST.svc/Sessions");HttpEntityrestEntity= httpClient.execute(request).getEntity();String restResult= new BufferedReader(new InputStreamReader(restEntity.getContent())).readLine();Android 2.2 (Java)Step 1:  UseHttpClient and HttpGet to makeconnection
Native ApplicationRESTMain.javaJSONArrayjArray = new JSONArray(restResult);for(inti=0; i<jArray.length(); i++){JSONObject session = jArray.getJSONObject(i);Log.i("Session retrieved", "Code: "+session.getString("Code")+" - "+session.getString("Title"));}Android 2.2 (Java)Step 2:  Useorg.jsonlibraries to deserialize JSON
public void runJSONParser(){        try{        Log.i("MY INFO", "Json Parser started..");        Gsongson = new Gson();Reader r = new InputStreamReader(getJSONData("http://search.twitter.com/trends.json”));        Log.i("MY INFO", r.toString());        TwitterTrendsobjs = gson.fromJson(r, TwitterTrends.class);        Log.i("MY INFO", ""+objs.getTrends().size());        for(TwitterTrendtr : objs.getTrends()){            Log.i("TRENDS", tr.getName() + " - " + tr.getUrl());        }        }catch(Exception ex){            ex.printStackTrace();        }    }Native ApplicationRESTAndroid 2.2 (Java)Step 3:  Optional – use GSON to supportserializationhttp://code.google.com/p/google-gson
Demo:  Consuming a REST based service on Android
“REST appears to be fairly straightforward – but how about my services use SOAP?”
Native ApplicationiSOAP.cs [ServiceContract]public interface ISOAP{[OperationContract]List<SessionSummary> GetSessions();}SOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)SOAP.svc.cspublic class SOAP : ISOAP{public List<SessionSummary> GetSessions(){// code to return active sessions}}Android 2.2 (Java)
No easy way of saying this, but: “It’s not as easy as you were hoping!”
Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 1:  Handcraft the SOAP request/handle the SOAP response
Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 2:  Yoursearcheswilllikelytakeyou down the road of gSOAP and WSMakeStubs
Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 3:  wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommendedhttp://code.google.com/p/wsdl2objc
Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 3:  wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommended
iPhoneClientViewController.mBasicHttpBinding_ISOAPBinding *myBinding = [SOAP BasicHttpBinding_ISOAPBinding];myBinding.logXMLInOut= true;SOAP_GetTitleForCode*parameters = [[SOAP_GetTitleForCode new] autorelease];parameters.code= [[NSStringalloc]initWithString:[numberTextField text]];BasicHttpBinding_ISOAPBindingResponse*response = [myBindingGetTitleForCodeUsingParameters:parameters];NSArray*responseBodyParts = response.bodyParts;for (id bodyPart in responseBodyParts){NSString *message = [bodyPartGetTitleForCodeResult];}Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 3:  wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommended
Demo:  Consuming a SOAP based service on iPhone/iPad
Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 3:  wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommendedWSDLXSDXSD
Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Step 1:  Ensurethat the namespace of the XSD elementsmatches the namespace of the service[DataContract(Namespace = "http://neudesic.com")]WSDLXSDXSDStep 2:  Considerflattening WSDL and XSDhttp://wcfextras.codeplex.com
“How about SOAP support on Android?  A similar story?”
wsimportUsage: wsimport [options] <WSDL_URI>where [options] include:  -b <path>                 specify jaxws/jaxb binding files or additional schemas                            (Each <path> must have its own -b)  -B<jaxbOption>            Pass this option to JAXB schema compiler  -catalog <file>           specify catalog file to resolve external entity references                            supports TR9401, XCatalog, and OASIS XML Catalog format.  -d <directory>            specify where to place generated output files  -extension                allow vendor extensions - functionality not specified                            by the specification.  Use of extensions may                            result in applications that are not portable or                            may not interoperate with other...Native ApplicationSOAP (WS-I)Android 2.2 (Java)Youwouldthinkthatwsimportshouldwork
Native ApplicationSOAP (WS-I)Android 2.2 (Java)http://ksoap2.sourceforge.net
Native ApplicationSOAP (WS-I)Android 2.2 (Java)http://code.google.com/p/ksoap2-android
Native ApplicationSOAP (WS-I)Android 2.2 (Java)maveninstallKSOAP2-Android
Main.javaString SOAP_ACTION = "http://tempuri.org/ISOAP/GetTitleForCode";String METHOD_NAME = "GetTitleForCode";String NAMESPACE = "http://tempuri.org/";String URL = "http://sguest01/TRMobile/Services/SOAP.svc";SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);request.addProperty("code","ARC310");SoapSerializationEnvelopeenv = new SoapSerializationEnvelope(SoapEnvelope.VER11);env.dotNet= true;env.setOutputSoapObject(request);HttpTransportSE transport = new HttpTransportSE(URL);transport.call(SOAP_ACTION, env);SoapPrimitivereturnedTitle = (SoapPrimitive)env.getResponse();Native ApplicationSOAP (WS-I)Android 2.2 (Java)
Demo:  Consuming a SOAP based service on Android
“How about connecting iPhone, iPad, and Android to Windows Azure?”
Native ApplicationiPad/iPhone OS 4.2 (ObjC)Web RoleMobile Web (ASP.NET MVC + jQueryMobile)REST EndpointSOAP EndpointAndroid 2.2 (Java)
Native ApplicationPUT http://myaccount.blob.core.windows.net/mycontainer/myblockblob HTTP/1.1Request Headers:x-ms-version: 2009-09-19x-ms-date: Sun, 27 Sep 2009 22:33:35 GMTContent-Type: text/plain; charset=UTF-8x-ms-blob-type: BlockBlobx-ms-meta-m1: v1x-ms-meta-m2: v2Authorization: SharedKey myaccount:YhuFJjN4fAR8/AmBrqBz7MG2uFinQ4rkh4dscbj598g=Content-Length: 11Request Body:{binary representation of photo}RESTAzureBlob StorageRESTiPad/iPhone OS 4.2 (ObjC)AzureTable StorageRESTAzureQueuesAndroid 2.2 (Java)
Token LengthPayload LengthJSON formatted0032deviceToken034messageNative ApplicationApp User AcceptanceTCP SSL connectionAnytime when onEvery 15 mins when sleepiPad/iPhone OS 4.2 (ObjC)Worker Role
https://android.apis.google.com/c2dm/sendregistration_idcollapse_keydata.<key>delay_while_idleAuthTokenC2DMNative ApplicationUser AcceptanceRegister IntentSend MessageAdditional DataAndroid 2.2 (Java)Worker Rolehttp://code.google.com/android/c2dm
TakeawaysRecommendations:Use REST whenever you have a choice
Push notification to both iOS and Android possible using Windows Azure worker roles
Get a good development environment setup with Fiddler/network snifferWatch out for:Asyncvs Sync operation.  Both iOS and Android support sync, but don’t use it!
Very limited support for WS-* on native iOS and Android libraries
“Many of Microsoft’s server products also expose REST/SOAP.  What options exist for consuming these?”
“Let’s start with SharePoint Server”
Custom:  Native Client to Services or Mobile Web Middle TierPackaged:  Use AppStore/Market ClientiPad/iPhone OS 4.2Basic:  Use OOB Mobile RenderingSharePoint Server2007/2010Android 2.2
iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
Basic:  Use OOB Mobile RenderingPros:  Easy to setup, works out of the box (with SPS2010)Cons:  Basic, non-native CSS. No support for browser-based NTLM from Android.  No caching of username/password credentials.iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
Custom:  Native Client to Services or Mobile Web Middle TierPackaged:  Use AppStore/Market ClientiPad/iPhone OS 4.2Basic:  Use OOB Mobile RenderingSharePoint Server2007/2010Android 2.2
iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2http://itunes.apple.com/us/app/filamente-sharepoint-client
iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2http://itunes.apple.com/us/app/shareplus-office-mobile-client
iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
Packaged:  Use AppStore/Market ClientPros:  Cheap ($10 – $20 per client).  Multiple authentication schemes.  Cached credentials.  Some offline/sync support.Cons:  All site content for mobile users.  Leaf nodes are mostly read only HTML (e.g. Announcements).  Most solutions are iPhone only (limited Android)iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
Custom:  Native Client to Services or Mobile Web Middle TierPackaged:  Use AppStore/Market ClientiPad/iPhone OS 4.2Basic:  Use OOB Mobile RenderingSharePoint Server2007/2010Android 2.2
SPWeb (2007)ODATA (2010)iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
SPWeb (2007)ODATA (2010)iPad/iPhone OS 4.2Mobile Web Rendering of informationuseful to Mobile clientsSharePoint Server2007/2010ASP.NET MVCMiddle Tier(jQueryMobile)Android 2.2
SPWeb (2007)ODATA (2010)iPad/iPhone OS 4.2Mobile Web Rendering of informationuseful to Mobile clientsSharePoint Server2007/2010ASP.NET MVCMiddle Tier(jQueryMobile)Android 2.2
SPWeb (2007)ODATA (2010)Custom:  Native Client or Middle Web TierPros:  Complete custom solution.  Can even hide fact that back end is SharePoint-based.Cons: More expensive option.  Limitations with SOAP client libraries for iPhone/Android.iPad/iPhone OS 4.2Mobile Web Rendering of informationuseful to Mobile clientsSharePoint Server2007/2010ASP.NET MVCMiddle Tier(jQueryMobile)Android 2.2
“Do the same options apply to Dynamics CRM?”
Custom:  Native Client to Services or Mobile Web Middle TierPackaged:  Use AppStore/Market ClientiPad/iPhone OS 4.2Basic:  Use OOB Mobile RenderingDynamics CRM4.0/2011Android 2.2
iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2http://www.microsoft.com/downloads/en/details.aspx?FamilyID=f592ec6c-f412-4fd5-9a80-cd3bcbd26d8b
iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
Basic:  Use OOB Mobile RenderingPros:  Easy to setup, works out of the box.  Forms based authentication works with non-NTLM browsers.Cons:  Basic, non-native CSS.  Controls a little awkward.  No user-agent detection. No caching of username/password credentials.iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
Custom:  Native Client to Services or Mobile Web Middle TierPackaged:  Use AppStore/Market ClientiPad/iPhone OS 4.2Basic:  Use OOB Mobile RenderingDynamics CRM4.0/2011Android 2.2
iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2http://tendigits.com/mobileaccess.html
iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2http://itunes.apple.com/us/app/cwr-mobile-crm-v4-2-for-microsoft
iPad/iPhone OS 4.2Optimized renderingDynamics CRM4.0/2011CWR/TenDigitsMiddle TierAndroid 2.2
Packaged:  Use AppStore/Market ClientPros:  Offline access.  Cached credentials.Cons:  All site content for mobile users. Most solutions are iPhone only (limited Android)iPad/iPhone OS 4.2Optimized renderingDynamics CRM4.0/2011CWR/TenDigitsMiddle TierAndroid 2.2
Custom:  Native Client to Services or Mobile Web Middle TierPackaged:  Use AppStore/Market ClientiPad/iPhone OS 4.2Basic:  Use OOB Mobile RenderingDynamics CRM4.0/2011Android 2.2
SOAP Web Services (4.0)REST Endpoint (2011)Updated Web Services (2011)ODATA (2011)iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
SOAP Web Services (4.0)REST Endpoint (2011)Updated Web Services (2011)ODATA (2011)iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
Custom:  Native Client or Middle Web TierPros:  Complete custom solution.  Can even hide fact that back end is Dynamics-based.Cons: Limitations with SOAP client libraries for iPhone/Android.  On CRM 2011, REST endpoint only provides limited CRUD.  Web Service (SOAP) endpoint uses WS-Security with Kerberos.SOAP Web Services (4.0)REST Endpoint (2011)Updated Web Services (2011)ODATA (2011)iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
TakeawaysRecommendations:Think about accessing SPS/CRM three ways
Basic Web
Packaged
Custom
Custom is (IMO) the most interesting to customersWatch out for:Mobile Web is very basic
Packaged solutions are good, but expose whole site
Pains with SOAP libraries on devices
CRM 2011 REST interface only allows certain CRUD operations
CRM 2011 Web Service uses WS-Security w/ Kerberos tokens“You’ve mentioned ODATA many times.  What’s the story?”
XTDS ProtocoliPad/iPhone OS 4.2SQL ServerAndroid 2.2
Native ApplicationODataiPad/iPhone OS 4.2 (ObjC)WCFDataServiceSQL ServerEDMX
Native ApplicationODATA.svc public class ODATA : DataService<SessionModelContainer>{     public static void InitializeService(DataServiceConfigurationconfig){config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;}}ODATAiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Server
Native ApplicationODATAiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Serverhttp://interoperabilitybridges.com
Native Applicationodatagen./odatagen /uri=http://sguest01/TRMobile/Services/ODATA.svc /out=.-rw-r--r--  1 Simon  staff   5738 Feb 10 13:09 SessionModelContainer.h-rw-r--r--  1 Simon  staff  14735 Feb 10 13:09 SessionModelContainer.mODataiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Server
iPhoneClientViewController.m-(IBAction)callODATAService:(id)sender{SessionModelContainer *proxy = [[SessionModelContaineralloc] initWithUri:@"http://sguest01/TRMobile/Services/ODATA.svc" credential:nil];QueryOperationResponse *response = [proxy execute:@"Sessions"];NSMutableArray *sessions =[response getResult];	for (id session in sessions)	{NSLog(@"Session Code: %@",[session getCode]);NSLog(@"Session Title: %@", [session getTitle]);	}NSLog(@"Complete");}Native ApplicationODataiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Server
Demo:  Consuming an ODATA service on iPhone/iPad
Native ApplicationODataAndroid 2.2WCFDataServiceEDMXSQL Server
Native ApplicationODATAAndroid 2.2WCFDataServiceEDMXSQL Serverhttp://code.google.com/p/odata4j
Native ApplicationODATAAndroid 2.2WCFDataServiceEDMXSQL Serverhttp://www.restlet.org
Note:  Must be done with the full JSE version of Restlet.jarlibraries (no generator in the Android version)!Native ApplicationProxy Generationlib Simon$ java -cp org.restlet.jar:org.restlet.ext.xml.jar:org.restlet.ext.atom.jar:org.restlet.ext.freemarker.jar:org.restlet.ext.odata.jar:org.freemarker.jar org.restlet.ext.odata.Generator http://sguest01/TRMobile/Services/ODATA.svc ~/Desktop/ARC310/restlet-proxy/---------------------------OData client code generator---------------------------...The source code has been generated in directory: /Users/Simon/Desktop/ARC310/restlet-proxyODATAAndroid 2.2WCFDataServiceEDMXSQL Server
Main.javaTrmobileWebModelsServiceservice = new TrmobileWebModelsService();Query<sessionmodel.Session> query = service.createSessionQuery("/Sessions?$filter=startswith(Code,'VIR')%20eq%20true");for (Session session : query){// do work}Native ApplicationODataAndroid 2.2WCFDataServiceEDMXSQL Server
Demo:  Consuming an OData service on Android
Core DataSQLLiteiPad/iPhone OS 4.2OData+SyncWCFDataServiceEDMXSQL ServerSQLLiteAndroid 2.2
TakeawaysRecommendations:Easy to create feeds using OData
Easy to consume through native libraries
Easy to consume lists exposed by SharePoint 2010Watch out for:Anything that looks like SQL library on device

Building solutions on the Microsoft platform that target iPhone, iPad, and Android devices

  • 1.
    Building Solutions onthe Microsoft Platformthat target iPhone, iPad, and AndroidSimon GuestDirector, Mobility Solutionssimon.guest@neudesic.com
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
    www.comscore.com/Products_Services/Product_Index/MobiLens (trend usedfor Dec and Mar)WM6 loses 10% share in 12 months. What will WP7 bring?RIM remains strong, but steadily eroding shareAndroid on fire. From 2.8% to 28.7% in 12 monthsiOS holding steady around 25% market share
  • 16.
    Many customers lookingat building applications targeting iPhone, iPad, and Android devices
  • 17.
    But what ifyou have an existing investment in Microsoft technology?
  • 19.
    To give youthe tools and knowledge to connect iPhone, iPad, and Android devicesto a Microsoft platform and infrastructure
  • 22.
    “I’ve got anexisting web site...” “How do I make it render well on the iPhone and Android handsets?”
  • 23.
    Step 1: Need to identify mobile browsers
  • 24.
    User-Agent: Mozilla/4.0 (compatible;MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)HTTP RequestHTTP ResponsePagesWindows 7 / IE8.0
  • 25.
    UserAgent: Mozilla/5.0 (iPhone;U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5HTTP RequestHTTP ResponsePagesiPhone OS 4.2
  • 26.
    Mozilla/5.0 (iPad; U;CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.2.1 Mobile/7B334b Safari/531.21.10HTTP RequestHTTP ResponsePagesiPad OS 4.2
  • 27.
    Mozilla/5.0 (Linux; U;Android 2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1HTTP RequestHTTP ResponsePagesAndroid 2.2
  • 28.
    if (useragent contains”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0Pagesif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1PagesAndroid 2.2
  • 29.
    if (useragent contains”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
  • 30.
    if (useragent contains”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
  • 31.
    if (useragent contains”MSIE”)…User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerASP.NET MVCViewEngineif (useragentcontains ”Android”)…Mozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
  • 32.
    Demo: ImplementingMobile View Engines in ASP.NET MVC 3
  • 33.
    “Errr… OK– but it still looks like my original webpage”
  • 34.
    User-Agent: Mozilla/4.0 (compatible;MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerASP.NET MVCViewEngineMozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
  • 35.
  • 36.
    Device-Integrated Web FrameworksSenchaTouchhttp://sencha.comUnifyhttp://unify.github.com/unifyPhoneGaphttp://phonegap.com
  • 37.
    User-Agent: Mozilla/4.0 (compatible;MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.0ViewCSSControllerASP.NET MVCViewEngineMozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1ViewCSSAndroid 2.2
  • 38.
    User-Agent: Mozilla/4.0 (compatible;MSIE8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)Windows 7 / IE8.01. Copy SiteMasterintoMobileSiteMaster2. ImportjQueryMobileASP.NET MVCViewEngine3. Annotate structure of MobileSiteMasterMozilla/5.0 (Linux; U; Android2.2; en-gb; Nexus One Build/FRF50) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.14. Annotate individual viewsAndroid 2.2
  • 39.
    Demo: UsingjQueryMobile to create device specific UI
  • 40.
    TakeawaysRecommendations:Mobile Web siteswill let you target multiple devices with a single back end
  • 41.
    Use ASP.NET MVCwith ViewEngine support for device specific views
  • 42.
    Use ASP.NET MVC3 (not 2) for improved HTML5 attributesWatch out for:Many different UI frameworks – choose carefully, think about longevity
  • 43.
    MEAPs – MobileEnterprise Application Platforms (auto gen’d UI from single source)
  • 44.
    “We’ve covered MobileWeb pages, but how about if my site has REST/SOAP services?”
  • 45.
    Native ApplicationRESTiPad/iPhone OS4.2 (ObjC)SOAP (WS-I)Android 2.2 (Java)
  • 46.
    Native ApplicationRESTREST.svc<%@ ServiceHostService="TRMobile.Web.Services.SessionService" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>iPad/iPhone OS 4.2 (ObjC)Android 2.2 (Java)
  • 47.
    Native ApplicationSessionService.csRESTpublic classSessionService : ISessionService{public SessionSummary[] GetData(){// return active sessions }} iPad/iPhone OS 4.2 (ObjC)Android 2.2 (Java)
  • 48.
    Native ApplicationISessionService.csREST [ServiceContract] public interface ISessionService {[WebGet(UriTemplate = "/Sessions", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)] [OperationContract]SessionSummary[] GetData(); }iPad/iPhone OS 4.2 (ObjC)Android 2.2 (Java)
  • 49.
    Native ApplicationRESTiPad/iPhone OS4.2 (ObjC)Step 1: Youneed a JSON libraryhttp://stig.github.com
  • 50.
    iPhoneClientViewController.m-(IBAction)callRESTService:(id)sender{ NSURL *url =[NSURL URLWithString:@"http://sguest01/TRMobile/Services/REST.svc/Sessions"];NSMutableURLRequest *request = [NSMutableURLRequestrequestWithURL:url]; [request setHTTPMethod:@"GET"];connection = [[NSURLConnectionalloc] initWithRequest:requestdelegate:self]; if (connection) {NSLog(@"Connection was established");receivedData = [[NSMutableData data] retain]; }else {NSLog(@"Connection wasnull"); }}Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 2: UseNSMutableURLRequest to call the service
  • 51.
    iPhoneClientViewController.m- (void)connection:(NSURLConnection *)connectiondidReceiveResponse:(NSURLResponse *)response{NSLog(@"Received response from the REST call"); [receivedData setLength:0];}-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{NSLog(@"Received data from the REST call"); [receivedDataappendData:data];}-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{NSLog(@"REST call failed with an error");}Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 3: Handle callbacks
  • 52.
    iPhoneClientViewController.m-(void)connectionDidFinishLoading:(NSURLConnection *)connection{NSLog(@"Connection finishedloading");NSString *responseString = [[NSStringalloc]initWithData:receivedData encoding:NSUTF8StringEncoding];NSLog(@"%@",responseString);NSArray *dict = [responseStringJSONValue]; for (id obj in dict) {NSDictionary *session = [[NSDictionaryalloc] initWithDictionary:obj];NSString *sessionCode = [session valueForKey:@"Code"];NSLog(@"%@",sessionCode); }NSLog(@"Complete");}Native ApplicationRESTiPad/iPhone OS 4.2 (ObjC)Step 4: Get the response, deserialize JSON
  • 53.
    Demo: Consuminga REST based service on iPhone/iPad
  • 54.
    “Great! Isit a similar process on Android?”
  • 55.
    Native ApplicationRESTMain.javaHttpClienthttpClient =new DefaultHttpClient();HttpGetrequest = new HttpGet("http://sguest01/TRMobile/Services/REST.svc/Sessions");HttpEntityrestEntity= httpClient.execute(request).getEntity();String restResult= new BufferedReader(new InputStreamReader(restEntity.getContent())).readLine();Android 2.2 (Java)Step 1: UseHttpClient and HttpGet to makeconnection
  • 56.
    Native ApplicationRESTMain.javaJSONArrayjArray =new JSONArray(restResult);for(inti=0; i<jArray.length(); i++){JSONObject session = jArray.getJSONObject(i);Log.i("Session retrieved", "Code: "+session.getString("Code")+" - "+session.getString("Title"));}Android 2.2 (Java)Step 2: Useorg.jsonlibraries to deserialize JSON
  • 57.
    public void runJSONParser(){       try{        Log.i("MY INFO", "Json Parser started..");        Gsongson = new Gson();Reader r = new InputStreamReader(getJSONData("http://search.twitter.com/trends.json”));        Log.i("MY INFO", r.toString());        TwitterTrendsobjs = gson.fromJson(r, TwitterTrends.class);        Log.i("MY INFO", ""+objs.getTrends().size());        for(TwitterTrendtr : objs.getTrends()){            Log.i("TRENDS", tr.getName() + " - " + tr.getUrl());        }        }catch(Exception ex){            ex.printStackTrace();        }    }Native ApplicationRESTAndroid 2.2 (Java)Step 3: Optional – use GSON to supportserializationhttp://code.google.com/p/google-gson
  • 58.
    Demo: Consuminga REST based service on Android
  • 59.
    “REST appears tobe fairly straightforward – but how about my services use SOAP?”
  • 60.
    Native ApplicationiSOAP.cs [ServiceContract]publicinterface ISOAP{[OperationContract]List<SessionSummary> GetSessions();}SOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)SOAP.svc.cspublic class SOAP : ISOAP{public List<SessionSummary> GetSessions(){// code to return active sessions}}Android 2.2 (Java)
  • 61.
    No easy wayof saying this, but: “It’s not as easy as you were hoping!”
  • 62.
    Native ApplicationSOAP (WS-I)iPad/iPhoneOS 4.2 (ObjC)Option 1: Handcraft the SOAP request/handle the SOAP response
  • 63.
    Native ApplicationSOAP (WS-I)iPad/iPhoneOS 4.2 (ObjC)Option 2: Yoursearcheswilllikelytakeyou down the road of gSOAP and WSMakeStubs
  • 64.
    Native ApplicationSOAP (WS-I)iPad/iPhoneOS 4.2 (ObjC)Option 3: wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommendedhttp://code.google.com/p/wsdl2objc
  • 65.
    Native ApplicationSOAP (WS-I)iPad/iPhoneOS 4.2 (ObjC)Option 3: wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommended
  • 66.
    iPhoneClientViewController.mBasicHttpBinding_ISOAPBinding *myBinding =[SOAP BasicHttpBinding_ISOAPBinding];myBinding.logXMLInOut= true;SOAP_GetTitleForCode*parameters = [[SOAP_GetTitleForCode new] autorelease];parameters.code= [[NSStringalloc]initWithString:[numberTextField text]];BasicHttpBinding_ISOAPBindingResponse*response = [myBindingGetTitleForCodeUsingParameters:parameters];NSArray*responseBodyParts = response.bodyParts;for (id bodyPart in responseBodyParts){NSString *message = [bodyPartGetTitleForCodeResult];}Native ApplicationSOAP (WS-I)iPad/iPhone OS 4.2 (ObjC)Option 3: wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommended
  • 67.
    Demo: Consuminga SOAP based service on iPhone/iPad
  • 68.
    Native ApplicationSOAP (WS-I)iPad/iPhoneOS 4.2 (ObjC)Option 3: wsdl2objc (http://code.google.com/p/wsdl2objc/)Version 0.7-pre1 recommendedWSDLXSDXSD
  • 69.
    Native ApplicationSOAP (WS-I)iPad/iPhoneOS 4.2 (ObjC)Step 1: Ensurethat the namespace of the XSD elementsmatches the namespace of the service[DataContract(Namespace = "http://neudesic.com")]WSDLXSDXSDStep 2: Considerflattening WSDL and XSDhttp://wcfextras.codeplex.com
  • 70.
    “How about SOAPsupport on Android? A similar story?”
  • 71.
    wsimportUsage: wsimport [options]<WSDL_URI>where [options] include: -b <path> specify jaxws/jaxb binding files or additional schemas (Each <path> must have its own -b) -B<jaxbOption> Pass this option to JAXB schema compiler -catalog <file> specify catalog file to resolve external entity references supports TR9401, XCatalog, and OASIS XML Catalog format. -d <directory> specify where to place generated output files -extension allow vendor extensions - functionality not specified by the specification. Use of extensions may result in applications that are not portable or may not interoperate with other...Native ApplicationSOAP (WS-I)Android 2.2 (Java)Youwouldthinkthatwsimportshouldwork
  • 72.
    Native ApplicationSOAP (WS-I)Android2.2 (Java)http://ksoap2.sourceforge.net
  • 73.
    Native ApplicationSOAP (WS-I)Android2.2 (Java)http://code.google.com/p/ksoap2-android
  • 74.
    Native ApplicationSOAP (WS-I)Android2.2 (Java)maveninstallKSOAP2-Android
  • 75.
    Main.javaString SOAP_ACTION ="http://tempuri.org/ISOAP/GetTitleForCode";String METHOD_NAME = "GetTitleForCode";String NAMESPACE = "http://tempuri.org/";String URL = "http://sguest01/TRMobile/Services/SOAP.svc";SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);request.addProperty("code","ARC310");SoapSerializationEnvelopeenv = new SoapSerializationEnvelope(SoapEnvelope.VER11);env.dotNet= true;env.setOutputSoapObject(request);HttpTransportSE transport = new HttpTransportSE(URL);transport.call(SOAP_ACTION, env);SoapPrimitivereturnedTitle = (SoapPrimitive)env.getResponse();Native ApplicationSOAP (WS-I)Android 2.2 (Java)
  • 76.
    Demo: Consuminga SOAP based service on Android
  • 77.
    “How about connectingiPhone, iPad, and Android to Windows Azure?”
  • 78.
    Native ApplicationiPad/iPhone OS4.2 (ObjC)Web RoleMobile Web (ASP.NET MVC + jQueryMobile)REST EndpointSOAP EndpointAndroid 2.2 (Java)
  • 79.
    Native ApplicationPUT http://myaccount.blob.core.windows.net/mycontainer/myblockblobHTTP/1.1Request Headers:x-ms-version: 2009-09-19x-ms-date: Sun, 27 Sep 2009 22:33:35 GMTContent-Type: text/plain; charset=UTF-8x-ms-blob-type: BlockBlobx-ms-meta-m1: v1x-ms-meta-m2: v2Authorization: SharedKey myaccount:YhuFJjN4fAR8/AmBrqBz7MG2uFinQ4rkh4dscbj598g=Content-Length: 11Request Body:{binary representation of photo}RESTAzureBlob StorageRESTiPad/iPhone OS 4.2 (ObjC)AzureTable StorageRESTAzureQueuesAndroid 2.2 (Java)
  • 80.
    Token LengthPayload LengthJSONformatted0032deviceToken034messageNative ApplicationApp User AcceptanceTCP SSL connectionAnytime when onEvery 15 mins when sleepiPad/iPhone OS 4.2 (ObjC)Worker Role
  • 81.
  • 82.
  • 83.
    Push notification toboth iOS and Android possible using Windows Azure worker roles
  • 84.
    Get a gooddevelopment environment setup with Fiddler/network snifferWatch out for:Asyncvs Sync operation. Both iOS and Android support sync, but don’t use it!
  • 85.
    Very limited supportfor WS-* on native iOS and Android libraries
  • 86.
    “Many of Microsoft’sserver products also expose REST/SOAP. What options exist for consuming these?”
  • 87.
    “Let’s start withSharePoint Server”
  • 88.
    Custom: NativeClient to Services or Mobile Web Middle TierPackaged: Use AppStore/Market ClientiPad/iPhone OS 4.2Basic: Use OOB Mobile RenderingSharePoint Server2007/2010Android 2.2
  • 89.
    iPad/iPhone OS 4.2SharePointServer2007/2010Android 2.2
  • 90.
    iPad/iPhone OS 4.2SharePointServer2007/2010Android 2.2
  • 91.
    Basic: UseOOB Mobile RenderingPros: Easy to setup, works out of the box (with SPS2010)Cons: Basic, non-native CSS. No support for browser-based NTLM from Android. No caching of username/password credentials.iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
  • 92.
    Custom: NativeClient to Services or Mobile Web Middle TierPackaged: Use AppStore/Market ClientiPad/iPhone OS 4.2Basic: Use OOB Mobile RenderingSharePoint Server2007/2010Android 2.2
  • 93.
    iPad/iPhone OS 4.2SharePointServer2007/2010Android 2.2http://itunes.apple.com/us/app/filamente-sharepoint-client
  • 94.
    iPad/iPhone OS 4.2SharePointServer2007/2010Android 2.2http://itunes.apple.com/us/app/shareplus-office-mobile-client
  • 95.
    iPad/iPhone OS 4.2SharePointServer2007/2010Android 2.2
  • 96.
    Packaged: UseAppStore/Market ClientPros: Cheap ($10 – $20 per client). Multiple authentication schemes. Cached credentials. Some offline/sync support.Cons: All site content for mobile users. Leaf nodes are mostly read only HTML (e.g. Announcements). Most solutions are iPhone only (limited Android)iPad/iPhone OS 4.2SharePoint Server2007/2010Android 2.2
  • 97.
    Custom: NativeClient to Services or Mobile Web Middle TierPackaged: Use AppStore/Market ClientiPad/iPhone OS 4.2Basic: Use OOB Mobile RenderingSharePoint Server2007/2010Android 2.2
  • 98.
    SPWeb (2007)ODATA (2010)iPad/iPhoneOS 4.2SharePoint Server2007/2010Android 2.2
  • 99.
    SPWeb (2007)ODATA (2010)iPad/iPhoneOS 4.2Mobile Web Rendering of informationuseful to Mobile clientsSharePoint Server2007/2010ASP.NET MVCMiddle Tier(jQueryMobile)Android 2.2
  • 100.
    SPWeb (2007)ODATA (2010)iPad/iPhoneOS 4.2Mobile Web Rendering of informationuseful to Mobile clientsSharePoint Server2007/2010ASP.NET MVCMiddle Tier(jQueryMobile)Android 2.2
  • 101.
    SPWeb (2007)ODATA (2010)Custom: Native Client or Middle Web TierPros: Complete custom solution. Can even hide fact that back end is SharePoint-based.Cons: More expensive option. Limitations with SOAP client libraries for iPhone/Android.iPad/iPhone OS 4.2Mobile Web Rendering of informationuseful to Mobile clientsSharePoint Server2007/2010ASP.NET MVCMiddle Tier(jQueryMobile)Android 2.2
  • 102.
    “Do the sameoptions apply to Dynamics CRM?”
  • 103.
    Custom: NativeClient to Services or Mobile Web Middle TierPackaged: Use AppStore/Market ClientiPad/iPhone OS 4.2Basic: Use OOB Mobile RenderingDynamics CRM4.0/2011Android 2.2
  • 104.
    iPad/iPhone OS 4.2DynamicsCRM4.0/2011Android 2.2
  • 105.
    iPad/iPhone OS 4.2DynamicsCRM4.0/2011Android 2.2http://www.microsoft.com/downloads/en/details.aspx?FamilyID=f592ec6c-f412-4fd5-9a80-cd3bcbd26d8b
  • 106.
    iPad/iPhone OS 4.2DynamicsCRM4.0/2011Android 2.2
  • 107.
    iPad/iPhone OS 4.2DynamicsCRM4.0/2011Android 2.2
  • 108.
    Basic: UseOOB Mobile RenderingPros: Easy to setup, works out of the box. Forms based authentication works with non-NTLM browsers.Cons: Basic, non-native CSS. Controls a little awkward. No user-agent detection. No caching of username/password credentials.iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
  • 109.
    Custom: NativeClient to Services or Mobile Web Middle TierPackaged: Use AppStore/Market ClientiPad/iPhone OS 4.2Basic: Use OOB Mobile RenderingDynamics CRM4.0/2011Android 2.2
  • 110.
    iPad/iPhone OS 4.2DynamicsCRM4.0/2011Android 2.2http://tendigits.com/mobileaccess.html
  • 111.
    iPad/iPhone OS 4.2DynamicsCRM4.0/2011Android 2.2http://itunes.apple.com/us/app/cwr-mobile-crm-v4-2-for-microsoft
  • 112.
    iPad/iPhone OS 4.2OptimizedrenderingDynamics CRM4.0/2011CWR/TenDigitsMiddle TierAndroid 2.2
  • 113.
    Packaged: UseAppStore/Market ClientPros: Offline access. Cached credentials.Cons: All site content for mobile users. Most solutions are iPhone only (limited Android)iPad/iPhone OS 4.2Optimized renderingDynamics CRM4.0/2011CWR/TenDigitsMiddle TierAndroid 2.2
  • 114.
    Custom: NativeClient to Services or Mobile Web Middle TierPackaged: Use AppStore/Market ClientiPad/iPhone OS 4.2Basic: Use OOB Mobile RenderingDynamics CRM4.0/2011Android 2.2
  • 115.
    SOAP Web Services(4.0)REST Endpoint (2011)Updated Web Services (2011)ODATA (2011)iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
  • 116.
    SOAP Web Services(4.0)REST Endpoint (2011)Updated Web Services (2011)ODATA (2011)iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
  • 117.
    Custom: NativeClient or Middle Web TierPros: Complete custom solution. Can even hide fact that back end is Dynamics-based.Cons: Limitations with SOAP client libraries for iPhone/Android. On CRM 2011, REST endpoint only provides limited CRUD. Web Service (SOAP) endpoint uses WS-Security with Kerberos.SOAP Web Services (4.0)REST Endpoint (2011)Updated Web Services (2011)ODATA (2011)iPad/iPhone OS 4.2Dynamics CRM4.0/2011Android 2.2
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
    Custom is (IMO)the most interesting to customersWatch out for:Mobile Web is very basic
  • 123.
    Packaged solutions aregood, but expose whole site
  • 124.
    Pains with SOAPlibraries on devices
  • 125.
    CRM 2011 RESTinterface only allows certain CRUD operations
  • 126.
    CRM 2011 WebService uses WS-Security w/ Kerberos tokens“You’ve mentioned ODATA many times. What’s the story?”
  • 128.
    XTDS ProtocoliPad/iPhone OS4.2SQL ServerAndroid 2.2
  • 129.
    Native ApplicationODataiPad/iPhone OS4.2 (ObjC)WCFDataServiceSQL ServerEDMX
  • 130.
    Native ApplicationODATA.svc publicclass ODATA : DataService<SessionModelContainer>{ public static void InitializeService(DataServiceConfigurationconfig){config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;}}ODATAiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Server
  • 131.
    Native ApplicationODATAiPad/iPhone OS4.2 (ObjC)WCFDataServiceEDMXSQL Serverhttp://interoperabilitybridges.com
  • 132.
    Native Applicationodatagen./odatagen /uri=http://sguest01/TRMobile/Services/ODATA.svc/out=.-rw-r--r-- 1 Simon staff 5738 Feb 10 13:09 SessionModelContainer.h-rw-r--r-- 1 Simon staff 14735 Feb 10 13:09 SessionModelContainer.mODataiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Server
  • 133.
    iPhoneClientViewController.m-(IBAction)callODATAService:(id)sender{SessionModelContainer *proxy =[[SessionModelContaineralloc] initWithUri:@"http://sguest01/TRMobile/Services/ODATA.svc" credential:nil];QueryOperationResponse *response = [proxy execute:@"Sessions"];NSMutableArray *sessions =[response getResult]; for (id session in sessions) {NSLog(@"Session Code: %@",[session getCode]);NSLog(@"Session Title: %@", [session getTitle]); }NSLog(@"Complete");}Native ApplicationODataiPad/iPhone OS 4.2 (ObjC)WCFDataServiceEDMXSQL Server
  • 134.
    Demo: Consumingan ODATA service on iPhone/iPad
  • 135.
  • 136.
    Native ApplicationODATAAndroid 2.2WCFDataServiceEDMXSQLServerhttp://code.google.com/p/odata4j
  • 137.
  • 138.
    Note: Mustbe done with the full JSE version of Restlet.jarlibraries (no generator in the Android version)!Native ApplicationProxy Generationlib Simon$ java -cp org.restlet.jar:org.restlet.ext.xml.jar:org.restlet.ext.atom.jar:org.restlet.ext.freemarker.jar:org.restlet.ext.odata.jar:org.freemarker.jar org.restlet.ext.odata.Generator http://sguest01/TRMobile/Services/ODATA.svc ~/Desktop/ARC310/restlet-proxy/---------------------------OData client code generator---------------------------...The source code has been generated in directory: /Users/Simon/Desktop/ARC310/restlet-proxyODATAAndroid 2.2WCFDataServiceEDMXSQL Server
  • 139.
    Main.javaTrmobileWebModelsServiceservice = newTrmobileWebModelsService();Query<sessionmodel.Session> query = service.createSessionQuery("/Sessions?$filter=startswith(Code,'VIR')%20eq%20true");for (Session session : query){// do work}Native ApplicationODataAndroid 2.2WCFDataServiceEDMXSQL Server
  • 140.
    Demo: Consumingan OData service on Android
  • 141.
    Core DataSQLLiteiPad/iPhone OS4.2OData+SyncWCFDataServiceEDMXSQL ServerSQLLiteAndroid 2.2
  • 142.
  • 143.
    Easy to consumethrough native libraries
  • 144.
    Easy to consumelists exposed by SharePoint 2010Watch out for:Anything that looks like SQL library on device