Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
UNIT – III
The Microsoft way-component object model- From COM, COM+, DCOM to .NET
framework- evolution- web services technologies-XML,WSDL,UDDI,SOAP-Common
Language Runtime- .NET framework class library-ADO.NET,ASP.NET
3.1.1 INTERFACES:
1. Query Interface
2. IUnknown
3. IDispatch
Query Interface:
Query interface takes the name of the interface and checks whether the COM object
supports it.
If support exists, it returns the corresponding interface reference.
An error indication is returned if the interface queried for is not supported.
The supported interfaces are named using Interface Identifiers (IID’s).
IUnknown:
Containment is just the simple object composition technique - one object holds an exclusive
reference to another.
The first object is called as outer object and the second object is called as inner object. If a
request to the outer object needs to be handled by the inner object, the outer object simply
forwards the request to the inner object as in figure 3.2.
Consider the above example, the outer object’s IStream interface is implemented by
forwarding the calls to methods Read and Write in the inner object.
Containment suffices to reuse implementations contained in other components.
Containment is completely transparent to clients of an outer object.
A client calling an interface function cannot tell if the object providing the interface handles
the call, or the call is forwarded and handled by another object.
3.1.2.2 Aggregation:
Calls on this interface would then go directly to the inner object, saving the cost of
forwarding.
It is also important to maintain transparency, as a client of the outer object should not
know that a particular interface has been aggregated from an inner object as in figure 3.3.
Aggregation is suited only for deeply nested constructions. This results in increase of
complexity.
Aggregation can be put to work where efficient reuse of component functionality is
needed.
COM interfaces can be derived from other COM interfaces using (single) interface
inheritance.
The true nature of polymorphism in COM is the support of sets of interfaces by COM
objects.
The type of a COM object is the set of interface identifiers of the interfaces it supports. A
subtype is a superset of interfaces.
Categories:
COM defines a procedural library interface to request new object instances based on their
CLSID.
A CLSID is also a globally unique identifier to identify classes of COM objects.
The simplest way to create a new COM object is to call CoCreateInstance. (All COM
library procedure names start with Co for COM.).
This function takes a CLSID and an IID. It then creates a new instance of the specified
class (CLSID) and returns an interface of the requested type (IID).
An error indication is returned if COM failed to locate or start a server implementing the
requested CLSID, or if the specified class does not support the requested interface.
When creating a COM object, COM needs to map the given CLSID to an actual
component that contains the requested class.
COM supports a system registry that specifies which servers are available and which
classes they support.
Servers can be of one of three different kinds:
1. In-process servers support objects that live in the client’s process.
2. Local servers support objects on the same machine, but in a separate process.
3. Remote servers support objects on a different machine.
CoCreateInstance consults the registry to locate the server and, unless already active,
loads and starts it.
For an in-process server, this involves loading and linking a dynamic link library
(DLL).
For a local server, a separate executable (EXE) is loaded.
Finally, for a remote machine, the service control manager on the remote machine is
contacted to load and start the required server on that machine.
In the last two decades large number of changes took place in object oriented and
distributed component oriented paradigm.
To satisfy this demand, Microsoft developed the Distributed Component Object Model
(DCOM).
Both object and component paradigm consists of various issues.
Interoperability
Versioning
Language independence
Size and complexity of the system.
The development of DCOM began with introduction of the concept Graphical User Interface.
The DDE was designed for Microsoft Windows to allow applications to exchange data of
any particular type.
As DDE protocol is very complex and was interpreted by many software vendors,
Dynamic Data Exchange Management Library (DDEML) was created.
This library simplified the interfacing with the DDE protocol as well as provided a
common interface for all developers.
The architecture supports a “software bus” on which reusable software components can
be used and integrated with one another seamlessly.
In order to provide support for this reusable software components the entire object model
is based on an object based programming model.
The object model was selected because of its inability to provide inheritance.
This means that the architecture is capable of avoiding te fragile base class syndrome
which exists in other models.
The fragile base class syndrome appears when one class inherits the members and
behavior of another class.
The class which provides the behavior and member functions are known as the base class
while the other class is known as the derived class.
If the member and functionality of the base class changes then the behavior and member
functions of the derived class also changes.
Changes like this result in having to modify the base class which in turn requires the
compilation of all dependent classes.
DCOM builds on the client-side proxy objects and the server-side stub objects already
present in COM, to support inter-process communication.
For the communication between processes within a single machine, proxies and stubs
merely need to map all simple data types to and from streams of bytes.
As the sending and receiving processes execute on the same machine, there is no need to
worry about how data types are represented.
When receiving such an object reference, COM needs to make sure that a corresponding
proxy object exists on the receiving end as in figure 3.5.
A client issuing a call on object A. The called method takes a single parameter, referring
to an interface of object B.
As object A is in another process, a local proxy object mediates the call. The proxy
determines an object identifier (OID) for object B and an interface pointer identifier
(IPID) for the particular interface being passed.
The OID and the IPID are sent together with the client process’s ID to a stub in the server
process. The stub uses the OID to locate the local proxy for object B and the IPID to
locate the particular interface.
The stub then issues the original call, on behalf of the client. It passes the interface reference
of the local B proxy to object A, the receiver of the call.
To form machine-independent object references, DCOM combines the OID and IPID
with information that suffices to locate an object exporter.
An object exporter is an object provided by DCOM that knows how to bind the objects
exported by a server. Each object exporter has a unique ID (OXID), and this OXID is
included in an object reference.
If the object exporter has been contacted recently, the OXID is known locally, together with
contact information of the remote machine.
This caching mechanism speeds up the resolution of object references, even in the
presence of large numbers of objects.
If the object exporter referred to in an object reference is seen the first time, a final field
of the object reference is consulted. This field contains the symbolic information (a URL-
like stringbinding) needed to contact the OXID resolver object on the remote machine.
The remote OXID resolver is contacted and the contact information for the remote object
exporter with the given OXID is retrieved.
3.3 COM+
Programs written for the .NET Framework in figure 3.6 execute in a software
environment , known as the Common Language Runtime (CLR), an application virtual
machine that provides services such as security, memory management, and exception
handling. The class library and the CLR together constitute the .NET Framework.
Presently, Microsoft supports four languages: C#, JScript, Managed C++, and Visual
Basic.NET.
.NET framework moves application development from client-centric to server-centric.
.NET framework consists of
1. Common Language Runtime(CLR)
2. Windows Forms
3. ASP.NET
Web Forms
Web Services
4. ADO.NET
5. Visual Studio.NET
.NET is not a language but it is runtime and a library for writing and executing programs
in any compliant language.
The .NET Framework's Base Class Library provides user interface, data access, database
connectivity, cryptography, web application development, numeric algorithms, and
network communications.
Programmers produce software by combining their own source code with the .NET
Framework and other libraries.
.NET languages are not compiled to machine code. They are compiled to an Intermediate
Language called as Microsoft Intermediate Language (MSIL).
CLR accepts the IL code and recompiles to machine code. The recompilation is Just-in-
Time (JIT) meaning it is done as soon as a function or subroutine is called.
The JIT code stays in memory for subsequent calls. In cases where there is not enough
memory it is discarded.
UNIVERSAL DISCOVERY
DESCRIPTION AND INTEGRATION
(UDDI)
WSDL WSDL
3.7 WSDL
WSDL file is an XML document that describes a set of SOAP messages and how the
messages are exchanged.
This file uses XML schema standard to describe message formats.
In describing message contents, WSDL defines where the service is available and what
communication protocol is used to talk to the service.
There are several tools available to read a WSDL file and generate the code required to
communicate with an XML web service.
3.8 UDDI
UDDI stands for Universal Description, Discovery and Integration.
It is an XML based standard for describing, publishing and finding web services.
UDDI is a specification for a distributed registry of web services.
UDDI is platform independent, open framework.
It can communicate via SOAP, CORBA, Java RMI protocol.
UDDI uses WSDL to describe interfaces to web services.
UDDI registries are available on the internet. Companies or industry groups may choose to
implement their own private UDDI registries.
Three types of information can be registered into an UDDI registry:
White pages – describes the company offering the service (name, address, contacts).
Yellow pages – include industrial categories.
Green pages – describes the interface to the service in detail to write an application.
3.9 SOAP
Simple Object Access Protocol (SOAP).
SOAP is a successor of XML-RPC.
SOAP is a proposal for an XML-based standard that enables invocations on remote objects,
typically using HTTP.
It is a light weight protocol for exchange of messages in a distribute environment.
The SOAP standard provides standard ways to:
Describe the addressee of an invocation;
Encode a wide range of typical programming data types into invocation messages;
Defines what parts of a message must be understood or can be ignored.
A SOAP message contains the following elements as in figure 3.10:
An Envelope element that identifies the XML document as a SOAP message.
A Header element that contains the header information.
A Body element that contains the call and response information.
A Fault element that contains the error and status information.
The SOAP standard defines namespaces for,
SOAP envelopes - (schemas.xmlsoap.org/soap/envelope/).
SOAP encoding - (schemas.xmlsoap.org/soap/encoding/).
SOAP STRUCTURE:
<soap:Envelope
Xmlns:soap=http://www.w3.org/2001/12/soap-envelope
Soap encodingStyle=http://www.w3.org/2001/12/soap-encoding>
<soap:Header>
…….
</soap:Header>
<soap:Body>
………
<soap:Fault>
………
</soap:Fault>
</soap:Body>
</soap:Envelope>
ADVANTAGES:
IMAGING TEXT
CONFIGURATION SESSION STATE
SYSTEM.DATA SYSTEM.XML
EROPSERVICES
The organization of the class library is similar to the file system. Each folder is a Namespace.
Each file is an assembly exposing one or more types.
The root of the class library is the System Namespace.
Traditional libraries are language independent, operating systems independent, and contain
simple subroutine calls.
In .NET all services fall into a single, hierarchy organized, language independent class
library.
ITT73 COMPONENT TECHNOLOGY
It includes a huge collection of reusable classes, interfaces, and value types that optimize the
development process and provide access to system functionality.
The class library contains 25 second level namespaces that in turn contains thousands of
types exposing all services of the operating system.
All components developed by the users must be added to the class library before they can be
used.
NAMING CONVENTIONS:
.NET framework uses a dot syntax naming scheme that describes a hierarchy.
First part of the full name upto the right most dot is the namespace name. The last part of the
name is the type name.
Example: System.Collections.ArrayList
Naming scheme makes it easy for library developers extending the .NET framework.
Classes are accessed by namespaces, which resides within assemblies.
System.Object:
3.11 ADO.NET
ADO.NET is a set of computer software components that programmers can use to access data and
data services based on disconnected DataSets and XML. It is a part of the base class library that is
included with the Microsoft .NET Framework.It is commonly used by programmers to access and
modify data stored in relational database systems.
ADO.NET provides consistent access to data sources such as SQL Server and XML, and
to data sources exposed through OLE DB and ODBC. Data-sharing consumer applications
can use ADO.NET to connect to these data sources and retrieve, handle, and update the
data that they contain.
ADO.NET separates data access from data manipulation into discrete components that can
be used separately.
The dataSetobject can also be used independently of a .NET Framework data provider to
manage data local to the application or sourced from XML.
The ADO.NET classes are found in System.Data.dll, and are integrated with the XML
classes found in System.Xml.dll.
ADO.NET provides the most direct method of data access within the .NET Framework.
3.12 ASP.NET
ASP.NET Web pages, known officially as Web Formsare the main building blocks for
application development. Web forms are contained in files with a ".aspx" extension; these
files typically contain static (X)HTML markup, as well as markup defining server-side web
Controls and User Controls for the Web page.
ASP.NET uses a visited composites rendering technique. During compilation, the template
(.aspx) file is compiled into initialization code which builds a control tree (the composite)
representing the original template.
The initialization code is combined with user-written code (usually by the assembly of multiple
partial classes) and results in a class specific for the page. The page doubles as the root of the
control tree.
Actual requests for the page are processed through a number of steps. First, during the
initialization steps, an instance of the page class is created and the initialization code is
executed. This produces the initial control tree which is now typically manipulated by the
methods of the page in the following steps.
As each node in the tree is a control represented as an instance of a class, the code may
change the tree structure as well as manipulate the properties/methods of the individual
nodes. Finally, during the rendering step a visitor is used to visit every node in the tree,
asking each node to render itself using the methods of the visitor. The resulting HTML
output is sent to the client.
After the request has been processed, the instance of the page class is discarded and with it
the entire control tree. This is a source of confusion among novice ASP.NET programmers who
rely on the class instance members that are lost with every page request/response cycle.
TWO MARKS
3) Define DCOM.
9) What is UDDI?
Universal Description, Discovery and Integration (UDDI).
UDDI is also a regular web service , it serves as a directory of web services.
With the help of UDDI it is easy to find a web service from a group of web services of
same kind.
Context-bound type