320 likes | 478 Views
XML Web Services - .NET FRAMEWORK – Part 1. CHAPTER 1.1 – 1.3. Applications for various platforms and devices. Enabling you to build. .NET. provides. Development tools. Runtime environments. Server infrastructure. Intelligent software. Uses standards to integrate applications and devices.
E N D
XML Web Services - .NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3 tom perkins
Applications for various platforms and devices Enabling you to build .NET provides Development tools Runtime environments Server infrastructure Intelligent software tom perkins
Uses standards to integrate applications and devices .NET Hypertext Transfer Protocol (HTTP) XML SOAP tom perkins
Allows applications to exchange data using XML Web Services .NET Application 1 Application 2 XML Web Services tom perkins
Provides remoting infrastructure .NET Process A Allows applications running in different processes (same or different computers) to exchange data Process 1 Uses HTTP or binary protocols Process 2 tom perkins
Smart Client Software XML Web Services Core to app integration For Internet and Intranet apps; exchange data using HTTP, XML and SOAP Access data from any location by PC, mobile, or client using Web Services .NET Tools and Operational Systems Visual Studio .NET and the .NET Framework .Net Server Infrastructure Secure and scalable platform for distributing Web apps Includes:Windows 2000 servers .NET Servers .NET Enterprise Servers Build, host, and consume web apps tom perkins
Web Services • Allow client app to exchange data with another client or server • Server apps to exchange data with one another • Apps on any device with apps on any other device Mobile device Desktop computer XML Web Services Servers: tom perkins
CLS-Rules for language interoperability - Syntax CLI - Semantics European Computer Manufacturers Association standard defines CLS Compliant VisualBasic .NET VisualC# .NET VisualJ# .NET Visual C++ .NET all produce Intermediate Language (MSIL) code Framework runtime engine executes MSIL tom perkins
CLI Specifies, .NET Framework provides: • Common Language Runtime (CLR) • provides execution environment • CLR loads and executes your MSIL code • Common Type System (CTS) • a string in VB is a string in C# • provides data, value, and object types • no language superiority in .NET • Type safety • Operations performed on one type are performed on that type only • Each value has a type, each reference has a type • Managed Code • .NET loads and executes code, allocates memory, provides automatic garbage collection • Side-by-Side execution • Assemblies are deployment units in .NET • Assemblies contain IL code and metadata (name, version, version of dependent assemblies) • Different versions of app can run side by side tom perkins
VisualBasic .NET VisualC# .NET VisualJ# .NET Visual C++ .NET Web Forms XML Web Services Windows Forms ASP.NET .NET Framework Class Library – all common .NET Types Main components of .NET Framework Common Language Runtime Loads IL code, compiles into native code, enforces security and type safety, provides thread support (managed code) Win 32 tom perkins
Understanding the Common Language Runtime (CLR) Lesson 2 tom perkins
CLR Architecture CLR Components Functions of CLR components What we’ll look at … tom perkins
CLR Components Provide types for apps at runtime Loads classes into the runtime Base class support Class loader Multi-threading support for apps Exchange data with COM apps Converts MSIL code to native code MSIL/native compiler Manages code during execution Execption handing mechanism COM marshaller Enforces security restrictions Automatic memory management Strict type enforcement Code manager Debug engine Garbage collection Debug diff types of apps Exception mgr Security engine Type checker Thread Support tom perkins
For a program to run in the CLR: Source code • Describes the code • Identifies types used in code • Contains references to other types used • Instructions are CPU- independent • Must be compiled into CPU-dependent instructions CLS-compliant compiler Intermediate code (MSIL) Metadata Located in portable executable file tom perkins
Just-in-Time (JIT) Compilation CLR Memory • Portable execution file • Metadata • MSIL • Portable execution file • Metadata • MSIL Loaded into memory JIT Compiler (different for different CPU architectures) Compiled only 1st time used Native code Class loader Native code used on 2nd+ use tom perkins
Program initiation CLR Memory Code manager • Portable execution file • Metadata • MSIL • Calls entry point method • Main • WinMain • dllMain • places objects into memory • controls execution • Garbage collector • Checks objects on heap • Identifies objects no longer required • Removes them Native code tom perkins
During execution CLR Memory • Objects • Values • References Type Checker • Security Engine • Enforces security restrictions • Controls access to resources • Hard disk • Network connections Makes sure everything has a valid type Makes sure only valid operations are performed (int value assigned to int variable) Err raised if string assigned to int Native code tom perkins
Managed multithreading support Single process Can be divided into subprocesses Application domain Application domain Application domain Each domain can contain one or more threads Runtime monitors all threads in process tom perkins
Interoperating with unmanaged code CLR – Managed Code Managed Code COM Marshaller Data represented differently in diff environments COM Marshaller converts data formats when data is exchanged tom perkins
Other Components in CLR Structured Error Handling Mechanism Base Class Library Support Common Debug Engine Handles debugging in any CLS Language Debug on both local and remote computers tom perkins
CLR – Managed Execution Process eLearning – Chapter 1 Lesson 3 tom perkins
Managed Execution Process • Runs the application from within the CLR • Loads and executes the application • One major advantage – Automatic Memory Management – garbage collection • Other services performed: • JIT compilations • Ensuring type safety • Enforcing security • Handling exceptions tom perkins
Managed Execution Process involves Managed Code Managed Data • Self-describing code • Provides info to CLR • Gets run-time services from CLR • Info stored in metadata in portable executable files • describes code • describes types used by code • Allocated and released by garbage collector • Managed code can access both managed and unmanaged data tom perkins
With Garbage Collection, you don’t need to worry about: • Allocating memory • Not releasing memory that is no longer required • Trying to access released memory • Tasks of Automatic Memory Management • Allocating memory • Releasing memory • Implementing Finalizers tom perkins
Memory Allocation • Process is initiated • Contiguous address space is reserved (managed heap) • Pointer established (where next object will be located) • new creates new object • Memory allocated • ObjPtr moved Managed Heap ObjPtr new object ObjPtr • Much faster than unmanaged memory allocation • new operator may throw Out of Memory exception tom perkins
Releasing Memory • Application – set of roots • Point to object on heap or are null • Global and static object pointers • Local variables • Reference object parameters on thead stack • JIT compiler and runtime maintain list of roots • Garbage collection creates a reachability graph • Initially, all heap is considered garbage • GC, using root list, identifies reachable objects • GC collection process, frees memory on stack • Compression through memory copy • GC updates the root pointers on the list tom perkins
More Garbage (Collection, that is) • Objects on heap divided – Generations 0,1,2 • Generation 0 – recently created • Gen 0 searched, collected, compressed • Surviving objects promoted to higher generation • Gen 1,2 searched for unreachables only when needed tom perkins
GC • Can’t clean system resources (file handles, connection, etc) used by managed code • You must release memory in Dispose method • You must explicitly call Dispose method after you finish working with the object tom perkins
Finalize Method • Release system resources in Finalize method code • GC calls Finalize before releasing memory for that unreferenced object tom perkins
Finalization (Code cleanup) Finalizers – methods called just before object is garbage-collected. 2 Special methods – Dispose and Finalize Parent Object Dispose() Dispose method should release its resources plus resources owned by parent. Do so by calling Dispose() on the parent. Your Object Dispose() tom perkins
Dispose Method – 2 ways to execute YourClass (Can clean both managed and unmanaged resources) … … … 1) Call Dispose directly from your code … … -- or – Finalize() 2) call Dispose from your Finalize method. Dispose() … … … Dispose() should call GC.SupressFinalize() method – keeps GC from cleaning up twice (Dispose can clean only unmanaged resources - GC may have already got ‘em) Executed at GC time tom perkins
Looking Ahead Portable executable file MSIL All about Assemblies Assembly Manifest • Contains info about assembly and resources required (type data) • Runtime uses assembly manifest to load assemblies into runtime – required tom perkins