Presentation is loading. Please wait.

Presentation is loading. Please wait.

DEV386 Best Practices for.NET Smart Clients and Web Services Development Marc Ghys & Bart Debeuckelaere.NET architects, Euricom.

Similar presentations


Presentation on theme: "DEV386 Best Practices for.NET Smart Clients and Web Services Development Marc Ghys & Bart Debeuckelaere.NET architects, Euricom."— Presentation transcript:

1 DEV386 Best Practices for.NET Smart Clients and Web Services Development Marc Ghys & Bart Debeuckelaere.NET architects, Euricom

2 Agenda Smart clients and web services Custom user controls Offline business logic Error handling over SOAP No touch deployment Demo of a real-life example

3 Smart clients & web services Overview Web Services SOAP over LAN SOAP over WAN (ADSL) SOAP over Internet BackofficeSOAPWinFormApplication

4 Smart clients & web services Performance Design to performance Performance ≠ Scalability Focus on user experience Limit number of roundtrips Do web service calls when users expect it, e.g. not in the middle of a page in an OnLeave event Cache data to the max in your winform client Compress SOAP messages I.I.S. compression Custom compression Use Windows Server 2003 !!!

5 Smart clients & web services Security Windows built-in authentication mechanism Basic Basic over SSL Digest Integrated Client certificates SOAP headers Custom handling of authentication WS-Security (new in WSE) Set authentication mode in web.config file // Fragment of a Web.config file. <authentication mode= "Windows"> </authentication>

6 Smart clients & web services Windows integrated authentication Uses credentials of logged on user Transparent to user myWebService.Credentials = System.Net.CredentialCache.DefaultCredentials; Authentication bug causes repeated authentication roundtrips with every web service call in.NET framework 1.0 solved by QFExxxx codeTableManager.Credentials = new System.Net.NetworkCredential(“Marc",“pwd"); Can also be set manually

7 Smart clients & web services Client certificates Stronger Public Key cryptography Uses SSL 3.0 or TLS 1.0 protocol Many ways to manage access X509Certificate x509 = X509Certificate.CreateFromCertFile(@"c:\Marc.cer"); myPRoxy.ClientCertificates.Add(x509); Get certificate from store (new in WSE) store = WSE.X509CertificateStore.LocalMachineStore(WSE.X509CertificateStore.MyStore); store.OpenRead(); certificates = store.FindCertificateBySubjectString(“euricom")); Get certificate from a file

8 Securing a web service Using Windows integrated security Using a client certificate demo demo

9 Agenda Smart clients and web services Custom user controls Offline business logic Error handling over SOAP No touch deployment Demo of a real-life example

10 Custom user controls Overview Easy to add extra functionality Translation, security Force specific property values Font type & size, styling Encapsulation of 3rd party controls Transparent work-arounds for bugs Renaming properties & methods 3 possible approaches Inherit, wrap or extend

11 Custom user controls Deriving from an existing control Fastest way to create a custom control Derive from any existing control All standard functionality immediately available Automatically reuses designer of inherited control No real encapsulation Difficult to hide and/or rename properties and methods Very difficult to create a custom designer

12 Custom user controls Deriving from an existing control No multiple inheritance in.NET Impossible to derive from a ‘basecontrol’ that contains shared functionality for a set of controls (e.g. validation, formatting,...) System.Windows.Forms.TextBox Euricom.Toolkit.BaseControl Euricom.Toolkit.ListBox Solution: instantiate BaseControl in the custom control and delegate properties, methods and events

13 Custom user controls Wrapping an existing control User control derives from a ‘BaseControl’ Contains generic properties, methods and events used by all custom controls Reuse the functionality of an existing control by placing it on the user control Expose control’s features by delegating properties, methods and events Reuse of designer

14 Custom user controls Issues with wrapping controls Problem with delegating leave event Fires multiple times or not at all Solved in.NET framework 1.1 Performance issue in.NET framework 1.0 Solved with QFExxxx

15 Custom user controls Using extenders Loosely coupled way to add functionality to any existing control Implement the IExtenderProvider interface Built-in tooltip control is an extender Adds extra properties to existing controls At design-time, properties are added to the property windows of controls At run-time, properties are accessed through the extender toolTipExtender.SetToolTip(txtFirstName, “Name of the person”);

16 Custom user controls Using GDI+ to draw your control Gives you pixel-level control over how the control is shown OnPaint event provides GDI+ Graphics object protected override void OnPaint(PaintEventArgs p) { // Draw border around control p.Graphics.DrawRectangle(myPen, 0, 1, 300, 100); } Use Invalidate() to force redraw e.g. When a property has changed

17 Custom user controls Design-time support Reuse and improve built-in designers E.g adding extra markers using GDI+ by overriding OnPaintAdornments() Use TypeConverter class to improve generated code e.g. show ‘subproperties’ by deriving from ExpandableObjectConverter

18 Creating custom controls Wrapping an existing control Using an extender Inheriting an existing control Drawing the control with GDI+ Using the TypeConverter class demo demo

19 Agenda Smart clients and web services Custom user controls Offline business logic Error handling over SOAP No touch deployment Demo of a real-life example

20 Treating offline situations Executing business logic offline Need for business logic on the client E.g. validation of input data Put shared business logic in BusinessRules class and deploy to client BusinessObject class inherits from BusinessRule and adds persistence functionality

21 Treating offline situations Executing business logic offline MyApp.BusinessRules.Customer MyApp.BusinessObjects.Customer Server Client Data MyApp.DataAccess.Customer Customer.ValidateEmail(john@doe.com);

22 Agenda Smart clients and web services Custom user controls Offline business logic Error handling over SOAP Managing state No touch deployment Demo of a real-life example

23 Error handling over SOAP Overview Standard Exception over SOAP Limited to one exception and standard properties Returning serialized custom exceptions Create a custom exception class e.g. containing multiple ‘sub-exceptions’ Throw a new SOAP exception and put serialized custom exception in XML node

24 Error handling over SOAP Overview Using SOAP headers to transfer exceptions Define SOAP header class containing CustomException property Type can be anything (e.g. DataSet) Convert Exception data to CustomException type in WebService layer

25 Custom Exceptions Using SOAP headers to send a custom exception to a client demo demo

26 Agenda Smart clients and web services Custom user controls Offline business logic Error handling over SOAP No-touch deployment Demo of a real-life example

27 No-touch deployment AppUpdater component Three ways to check versions Direct file check Check on last modified date Manifest Check XML web service check Web service not included in AppUpdater, has to be developed seperately 1.1.5.2 http://appserver/crm/versions/V1152/

28 No-touch deployment AppUpdater component Files are downloaded using HTTP-DAV Includes directory and file enumeration Free source download Can be adapted to your needs

29 No-touch deployment Custom updater Written from scratch Flexibility in features, coding style, etc... Support for zone based deployment Deploying a new version to 4.500 clients is not done in 5 minutes! Deploy to zones of 500 clients in different timeframes Assemblies are compressed and sent as DIME attachments using WSE

30 No-touch deployment Custom updater Peach.exe Peach.exe Versions.xml Main form Withdrawal form Insurance form Version 2.0.1.28 Get version info through web service Download new version Main form Withdrawal form Insurance form as DIME attchment

31 No-touch deployment BITS Downloads software in background Used by Windows 2000, Windows XP and Windows 2003 for autoupdate Uses idle network bandwidth Resumes after network disconects, reboots Version 1.5 now available in Windows Server 2003, as upgrade for Win2000, XP

32 Download an updated assembly As a DIME attachment using WSE Using BITS demo demo

33 Agenda Smart clients and web services Custom user controls Offline business logic Error handling over SOAP No touch deployment Demo of a real-life example

34 Peach GUI Framework GUI Controls Wizard Control Error Handling TranslationSecurityCachingConfiguration PeachToday My Office CustomersInsuranceBanking Multipleapplicationsupport

35 Peach GUI Framework Advantages Allows seperated development teams to develop independent plug-in applications Framework handles inter-application communication Framework can be improved seperately Forces consistent look & feel Form & Wizard controls Quickstep

36 Peach GUI Framework Advantages Provides numerous technical facilities Error Handling Translation Security Caching

37 demo demo Peach GUI framework

38 Community Resources http://www.microsoft.com/communities/default.mspx Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx

39 evaluations evaluations

40 © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.


Download ppt "DEV386 Best Practices for.NET Smart Clients and Web Services Development Marc Ghys & Bart Debeuckelaere.NET architects, Euricom."

Similar presentations


Ads by Google