20
© Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

Embed Size (px)

Citation preview

Page 1: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013

Romano Roth

Workshop 6 (ws6C) native Entwicklung für mobile GeräteLektion 2: Service

18. February 2013Folie 1 von 19

Page 2: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Unser Plan

18.2 (Romano) Einführung, «Mega CRM», Aufsetzen25.2 (Romano) Einführung in Windows Phone 8 Entwicklung04.3 (Romano) Umsetzung «Mega CRM» mit Windows Phone 8 11.3 (Oliver) Einführung in Mono Entwicklung18.3 (Oliver) Umsetzung «Mega CRM» mit MonoTouch25.3 (Oliver) Umsetzung «Mega CRM» mit MonoDroid01.4 Kein Workshop (Ostern)08.4 (Michael) Einführung in iOS Entwicklung15.4 (Michael) Umsetzung «Mega CRM» mit iOS22.4 (Michael) Umsetzung «Mega CRM» mit iOS

18. February 2013 Folie 2 von 19

Page 3: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Lektion 2

• Der REST Service• Ab damit in die die Cloud• Retrospective (5’)

– Was war gut?– Was kann verbessert werden?

18. February 2013 Folie 3 von 19

Page 4: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Big Picture

Azure CloudREST Service

18. February 2013 Folie 4 von 23

Page 5: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

REST Representational State Transfer

• REST stammt aus der Dissertation von Roy Fielding aus dem Jahre 2000

• REST ist ein Architekturstiel– SOAP ist ein implementationsdetail einer RPC

Architektur• Prinzipien

– Adressierbarkeit Eindeutige URI

– Unterschiedliche Repräsentationenz.B. HTML, JSON oder XML

– Zustandslosigkeit – Operationen

GET, POST, PUT und DELETE– Verwendung von Hypermedia

Links auf weitere Resourcen

18. February 2013 Folie 5 von 19

Page 6: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

MEGA CRM REST Service

<Customer> <AssistantName>String</AssistantName> <Birthday>DateTime</Birthday> <City>String</City> <Company>String</Company> <Country>String</Country> <Department>String</Department> <Email>String</Email> <FaxNumber>String</FaxNumber> <FirstName>String</FirstName> <Id>Integer</Id> <Image>Byte</Image> <LastName>String</LastName> <ManagersName>String</ManagersName> <Margin>Integer</Margin> <MiddleName>String</MiddleName> <MobileNumber>String</MobileNumber> <Nickname>String</Nickname> <Office>String</Office> <PhoneNumber>String</PhoneNumber> <PostalCode>String</PostalCode> <Profession>String</Profession> <Sales>Integer</Sales> <State>String</State> <Street>String</Street> <Title>String</Title> <WebPage>String</WebPage></Customer

• GET– /customer

– Liste aller Kunden– /customer/{id}

– Kunde mit id=={id}• POST

– /customer– Erstelle den Kunden

• PUT– /customer

– Ersetze den Kunden– Erstelle den Kunden

• DELETE– /customer/{id}

– Lösche den Kunden18. February 2013 Folie 6 von 19

Page 7: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Service Stack

• REST Web Service Framework für .NET und Mono– Web Services done right, REST Service done easy

;-)

18. February 2013 Folie 7 von 19

Page 8: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

• Eine Cloud verwendet man um Rechenkapazität, Datenspeicher, Netzwerkkapazitäten und Software dynamisch über das Netz zur Verfügung zu stellen.

• IaaS – Infrastructure as a Service – Cloud bietet virtualisierte Computerhardware (Rechenzenter).

• PaaS – Platform as a Service – Cloud bieten Laufzeitumgebungen (Service Provider)

• SaaS – Software as a Service –Anwendungsprogrammen in der Cloud. (Software bei Bedarf)

Cloud

18. February 2013 Folie 8 von 19

Page 9: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

• Windows Azure (kurz Azure) ist die Microsofts Cloud• Features

– Websites– PaaS für alle Arte von WebSeiten

– Virtual maschines– IaaS Virtuelle Maschinen und Netzwerke

– Cloud Services– PaaS für Applikationen und Services

– Data Management– PaaS SQL Datenbank

– Media Services– PaaS für streamen und encoden von Medien

Windows Azure

18. February 2013 Folie 9 von 19

Page 10: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

• Datencenter– North America

– North-central US - Chicago, IL– South-central US - San Antonio, TX– West US - California– East US – Virginia

– Asia– East Asia - Hong Kong, China– South East Asia – Singapore

– Europe– West Europe - Amsterdam, Netherlands– North Europe - Dublin, Ireland

Windows Azure

18. February 2013 Folie 10 von 19

Page 11: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Walktrough - Azure

1. Erstellen des Windows Azure Account1. http://www.windowsazure.com2. Klicke auf Free Trial und folge den

Schritten3. Klicke Windows Azure Homee

Account Preview Features4. Schalte das Web Sites Preview ein

Anleitung18. February 2013 Folie 11 von 19

Page 12: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Walktrough – Setup Entwicklungsumgebung

1. Installiere Visual Studio 2010 oder 20122. Installiere Windows Azure SDK

Azure SDK VS 2012Azure SDK VS 2010

Anleitung18. February 2013 Folie 12 von 19

Page 13: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Walktrough – Erstellen einer Web Site

1. http://www.windowsazure.com2. Portal3. New Web Site Quick Create

1. Name: <NameOfWebSite>

Anleitung18. February 2013 Folie 13 von 19

Page 14: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

1. Visual Studio2. New Project3. ASP.NET MVC 4 Web Application4. http://www.windowsazure.com5. Zu der erstellten Web Seite <NameOfWebSite>

gehen und Download publishing profile klicken6. Visual Studio rechtsklick Solution Publish7. Import des publishing profiles von

<NameOfWebSite> 8. Validate Connection PublishAnleitung ASP.NET MVC 4

Walktrough – Deploy einer Web Site

18. February 2013 Folie 14 von 19

Page 15: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

1. Download des Source Code 2013_02_18.zip 2. Öffnen der Solution3. Build Clean Solution Rebuild Solution4. Rechtsklick Service Properties Use Local IIS

Web Server «localhost:50722» durch Euren Rechnernamen ersetzen. Create Virtual Directory

5. Commons.Common «localhost:50722» durch Euren Rechnernamen ersetzen.

6. Rebuild All7. Visual Studio rechtsklick Service Publish8. Import des publishing profiles von

<NameOfWebSite>

Walktrough – Deploy des Mega CRM Services

18. February 2013 Folie 15 von 19

Page 16: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Mega CRM Service

18. February 2013 Folie 16 von 19

Page 17: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Mega CRM Service

18. February 2013 Folie 17 von 19

Page 18: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

ZTG.Customer.Client.WPF

18. February 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth Folie 18 von 19

MainWindow(View)

MainWindowViewModel

(ViewModel)MainWindowUiServi

ce(Model)

Customer

ViewModel

ZTG.Customer.Service

ZTG.Customer.DataAccess

CustomerService

CustomerDataAccess

*.ConsoleConsole

*.ModelCustom

er

*.CommonCommon

Page 19: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

• Service• DataAccess

– Achtung: Daten sind in Memory reset nach neustart / redeploy

– TestDataGenerator• Model• Common• WPF Client• Console Client

Der Code

18. February 2013 Folie 19 von 19

Page 20: © Zühlke 2013 Romano Roth Workshop 6 (ws6C) native Entwicklung für mobile Geräte Lektion 2: Service 18. February 2013 Folie 1 von 19

© Zühlke 2013Workshop 6 (ws6C) native Entwicklung für mobile Geräte | Romano Roth

Retrospective

• Was war gut?• Was kann verbessert werden?

18. February 2013 Folie 20 von 19