Liberate Your Apps!

Post on 23-Feb-2016

23 views 0 download

Tags:

description

Liberate Your Apps!. Philippe Leefsma Senior Developer Consultant Autodesk Developer Network . Getting Started. Windows Communication Foundation ( WCF ) http :// msdn.microsoft.com/en-us/library/ms731082.aspx Cloud Hosting Providers http://www.windowsazure.com http ://aws.amazon.com. - PowerPoint PPT Presentation

transcript

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Liberate Your Apps!

Philippe LeefsmaSenior Developer Consultant

Autodesk Developer Network

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Getting Started

Windows Communication Foundation (WCF)

http://msdn.microsoft.com/en-us/library/ms731082.aspx

Cloud Hosting Providers http://www.windowsazure.com http://aws.amazon.com

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

WCF Web ServicesMigrate your Application logic

to the cloud…

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

What is WCF ? Windows Communication Foundation is

Microsoft's next-generation programming platform and runtime system for building, configuring and deploying network-distributed services

(Source MSDN)

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

WCF Unification

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

WCF Basics - ABC "ABC" is the key to understand how a WCF

service is composed:

"A" stands for Address: Where is the service?

"B" stands for Binding: How do clients talk to the service?

"C" stands for Contract: What can the service do for a client?

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Data Contract [DataContract] public class AdnMaterial {  [DataMember] public string Name { get; set; }  [DataMember] public double Price { get; set; }  [DataMember] public string Manufacturer { get; set; } }

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Service Contract [ServiceContract] public interface IMaterialSrv { [OperationContract] AdnMaterial[] GetMaterials();  [OperationContract] AdnMaterial GetMaterial( string materialName);  [OperationContract] bool PostMaterial( AdnMaterial material); }

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Implementing Services

public class MaterialSrv : IMaterialSrv { public MaterialSrv() { //Constructor... }

 

public AdnMaterial[] GetMaterials() { //Implementation... } 

//Implementation other methods... }

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Service bindings

A binding binds a service contract implementation to an address.

This includes:

Choosing an appropriate transport protocol

Choosing how messages are encoded

Defining how security works

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Hosting a Service

The following options are available to host a WCF Service:

Self-hosting in any managed .NET applicationWinform, WPF, console Application, …

Hosting in a Windows service

Hosting in IISASP.NetDirect Hosting

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

WCF Demo

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

HTTP Requests

World Wide Web (WWW) Web of resources Resources reference each other Resources can be of many types

(e.g., documents, images, services, html pages)

URI identifies resources (Uniform Resource Identifier)

HTTP used to access resources 9 methods (a.k.a. verbs): GET, PUT , POST , DELETE , … HEAD, OPTIONS, TRACE, CONNECT, PATCH

Author
modified title

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

SOAP

SOAP stands for Simple Object Access Protocol

Protocol for exchanging structured information through Web Services

Relies on XML for its message format, and Application Layer protocols like HTTP or SMTP for message transmission

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

REST

REST stands for Representational State Transfer

REST is an architectural style that exploits HTTP protocol

Provides an easier way of data access comparing with SOAP

Good solution for interoperability between web services and mobile platforms or browsers

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

REST Web Services Why REST?

REST is a lightweight alternative to SOAP

SOAP:

SOAP

REST

<?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/12/soap-envelope"> <soap:Body pb="http://www.adesk.com/memberdb">  <db:GetDeveloperDetails>   <db:DeveloperID>12345</db:DeveloperID>  </db:GetDeveloperDetails> </soap:Body></soap:Envelope>

http://www.adesk.com/memberdb/DeveloperDetails/12345

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

SOAP vs RESTSOAP

Supports only GET and POSTAll data is in the xml message

Resource to accessFunction to execute

REST

Uses all HTTP verbs: GET, POST, PUT, DELETE, …Resource is identified by URIFunction is identified by the HTTP verb

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

JSON JSON (JavaScript Object Notation) is a

lightweight data exchange format

JSON is a text format easy for humans to read and write and fast for machines to parse and generate

One of the most popular exchange format in web services at the moment

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

JSON vs XML { "Manufacturer":"ADN", "Name":"Steel", "Price":"100.0" }

<?xml version="1.0" encoding="UTF-8" ?> <Manufacturer>ADN</Manufacturer> <Name>Steel</Name> <Price>100.0</Price>

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Adding REST Support in WCF [ServiceContract] public interface IMaterialSrv { [OperationContract] [WebInvoke( Method = "GET", UriTemplate = "/Material/{materialName}", ResponseFormat = WebMessageFormat.Json)] AdnMaterial GetMaterial(string materialName);  [OperationContract] [WebInvoke( Method = "POST", UriTemplate = "/Material", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] bool PostMaterial(AdnMaterial material); }

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Deployment on the CloudAzure Example illustrated…

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Step I - Azure project

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Step 2 - Package Creation

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Step 3 - Azure Deployment

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential Information

Step 4 - Test

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Getting Started with Android programming

Install Eclipse http://www.eclipse.org/downloads/

Install Android SDKhttp://developer.android.com/sdk/installing.html

Get started with Android developmenthttp://developer.android.com/guide/index.html

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information

Getting Started with iOS programming

Install Xcode Downloadable from App Store Mac application

Includes SDK and iOS Simulator

Get started with iOS developmenthttps://developer.apple.com/devcenter/ios/index.action

Click to edit Master title style

• Click to edit Master text styles– Second level• Third level

– Fourth level» Fifth level

Autodesk Confidential InformationAutodesk Confidential Information