White Papers
Microsoft.Net and SOAP – Technical Overview
Introduction
Microsoft, .NET is a revolutionary new platform, built on open Internet protocols and standards, with tools and services that meld computing and communications in new ways.
It is a new environment for developing and running software applications, featuring ease of development of web-based services, rich standard run-time services available to components written in a variety of programming languages, and inter-language and inter-machine interoperability.
NET platform has not evolved from the DNA 2000 technology currently available rather, it is a totally new technology which is likely to shake up more than a few deep-rooted ideas.
Inside .Net Framework
Unpacking The .NET Framework Architecture
The primary goal of .NET is to provide developers with the means to create interoperable applications using "Web Services" from any sort of terminal, be it a PC, PDA , mobile phone, and so forth.

Figure 1: General .NET Architecture
Figure 1 shows the Microsoft .NET Framework architecture. Built on top of operating system services is a common language runtime that manages the needs of running code written in any modern programming language. The .NET Framework includes a set of class libraries that developers can use from any programming language. Above that sit various application programming models that provide higher-level components and services targeted specifically at developing Web sites and Web Services. Let me describe each of these layers.
Common Language Runtime (CLR)
The runtime loads and runs code written in any runtime-aware programming language. The runtime features cross-language integration, self-describing components, simple deployment and versioning, and integrated security services.
Cross Language Integration
Microsoft.Net framework incorporates a common type system that defines a standard set of types and rules for creating new types. This enables deep multi-language integration.
So, Code written in one language can now inherit implementation from classes written in another language. Exceptions can be thrown from code written in one language and caught in code written in another; and operations such as debugging and profiling work seamlessly regardless of the languages used to write the code.
Self-Describing Components
An Assembly to put in a more simple term is an .EXE or .dll file, that is created as a result of compiling an application or library file. It contains a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies.
These resources, types and references contained in an Assembly are described as a block of data called as Assembly Manifest or Metadata. The metadata or manifest is a part of the assembly and this is the one which makes it self-describing.
Executable Code + Metadata (or Manifest) = > Assembly (unit of deployment).
Managed Code
Managed code is code that is written to target the services of the Common Language Runtime (see What is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic.NET, and JScript.NET code is managed by default.
How Can I Produce An Assembly?
For example, the following C# program
can be compiled into a library assembly (dll) like this
This command outputs the assembly, clsasm.dll. You can then view the contents of this assembly by running the "IL Disassembler" tool that comes with the .NET SDK.
Figure 3 shows the metadata or assembly manifest associated with the assembly clsasm.dll. A key advantage of self-describing components is that no other files are needed to use the components. No separate header files, configuration information, IDL files, type libraries, or proxy/stubs are required to access a component. All the necessary information is located in the component's metadata. So, an assembly becomes the unit of deployment in the .Net Framework.
RealProducer is a technology from RealNetworks that provides for an easy conversion of non-RealMedia format files to RealMedia files. The purpose of the RealProducer SDK is to allow you to create an application that converts audio, video, events, and image map data into the RealMedia file format. The output file can then be streamed over the Internet or Intranet using a RealServer and viewed with a RealPlayer. An application created with the RealProducer SDK can also broadcast a stream that is sent directly to a RealServer.
Some Of The Key Advantages Of CLR
- Multiple versions of an assembly can be deployed on a machine at the same time. The Application configuration information contained in each version of the assembly defines where to look for assemblies, thus the runtime can load different versions of the same assembly for two different applications that are running concurrently. This eliminates issues that arise from incompatibilities between component versions, improving overall system stability.
- Because assemblies are self-describing, no explicit registration with the operating system is required. So no more regsvr or things like that. So deployment is as simple as copy and paste assemblies (dll’s) to the desired directory.
- CLR supplies integrated, pervasive security services to ensure that unauthorized users cannot access resources on a machine and that code cannot perform unauthorized actions. This improves overall system safety and reliability.
Base Class Library
Net framework provides a common set of base class libraries, which any language targeted at CLR can make use of. Namespaces provide the naming scope for the classes and is very convenient way to represent hierarchy of classes.
Some of the main namespaces included in the base class libraries are
| System | Contains all the basic types used by every application |
| System.Data | Contains basic database management types |
| System.IO | Contains classes to manage I/O |
| System.Net | Contains classes that allow for network communications. |
| System.Reflection | Contains classes that allow inspection of metadata |
| System.Security | Contains types that enable security features |
| System.WinForms | Contains types that enable rich user-interface for desktop applns. |
Application Model In .Net
On the top of .Net Framework Architecture sits two application models: Windows application model and the Web application model.
Windows Application Model: WinForms
Developers writing client applications for Windows can use the Win Forms application model to take advantage of all the rich user interface features of Windows, including existing ActiveX controls and new features of Windows 2000, such as transparent, layered an floating windows.
Win Forms also takes advantage of the Microsoft.Net Framework runtime to reduce total cost of ownership for Windows-based client applications. The framework security model can safely execute applications and components on client machines provided they are written using the Win Forms model or used from a Win Forms application. The System.WinForms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the M Microsoft Windows operating system. Let us see an example how an Win Form application is used to list the files inside a folder.
To List The Files In A Folder Using Win Form Application
This example uses C#, but the same tools for simplifying Web Service creation are available in other language products in Visual Studio. First you would create a new Windows Application project in C# called ListFolders, as shown in Figure no.
Open the Design Window of Form1.cs. The figure no shows the components that are added to Form1 from the Toolbox. Visual Studio.Net automatically generates all the code necessary to create these components at the back, which can be viewed by opening the Code window of Form1.cs.
Now double click on the button, in my case btnListFiles on Form1. VS.Net now opens the code window of Form1.cs, with the cursor blinking at the below function, btnListFiles_Click. Now add the following code to the function. protected void btnListFiles_Click (object sender, System.EventArgs e)
Now rightclick on project ‘ListFolders’ in Solution Explorer then choose Debug then click on Start.
Now enter the directory path in the textbox, then click on the button, you would see the following display.
Web Application Model
Web Application model encompasses both Web applications that generate pages for display in a browser and Web Services.
Introduction To ASP.NET
ASP.Net evolves from Active Server Pages. ASP+ takes advantage of the Common Language Runtime and services framework to build robust, reliable, scalable hosting environment for Web applications. ASP.Net currently offers built-in support for three languages, C#, Visual Basic and Jscript.
Features of ASP.NET
Let us discuss some of the highlighting features of ASP+ . ASP+ uses the Microsoft .NET Framework deployment model based on assemblies, thus gaining all its benefits such as XCOPY deployment, side-by-side deployment of assemblies, and XML-based configuration.
Another important feature of ASP.Net, is the concept of shadow dll. ASP.Net keeps shadow copies of the assembly dll’s that it references. These shadow assemblies – and not the original files – are then locked and loaded b the runtime. Because the original assembly files always remain unlocked, developers and administrators are free to delete/replace/rename them without cycling the web server or having to use a special tool. Let me explain you with a practical scenario. Suppose an Asp.Net web page referring to an assembly (dll) is running in the browser. During this time, you can very well delete/replace/rename the referred assembly. It doesn’t affect the currently running page, but the changes are automatically picked up in the subsequent requests. ASP+ enhances the state management services introduced by ASP to provide three types of state to Web applications: application, session, and user. ASP+ also provides caching services to improve performance. Since ASP.Net applications run in the context of AppDomains, it provides isolation and enforcement of security restrictions.
Now let's take a quick look at the two higher-level programming models that build on the ASP+ programming model: ASP+ Web Forms and ASP+ Web Services.
ASP+ Web Forms
In today's ASP application, we have a mix of HTML and Scripts making the code difficult to read, debug and maintain. ASP.NET relieves us from this problem by promoting the separation of code and content. That is, the user interface and the user interface programming logic need not necessarily be written in a single page. There are two ways in which you can separate the code and content
- By using Code-behind files that are pre-compiled modules written in any of the Microsoft .NET runtime compliant languages.
- By developing the frequently used page logic in to separate files called Pagelets (also known as page controls) and by using them several times in your ASP.NET pages.
Code Behind Web Pages In ASP.NET
Let us see a practical example how Code-behind files works in ASP.NET.
- Create the User Interface using the HTML and/or Web controls and store them in an ASP.NET page with extension ".aspx".
- Create the code-behind file using the .NET runtime classes that mimic the entire ASP.NET page with the member variables that correspond to the HTML and/or Web controls used in the ASP.NET page. The extension of code behind files will vary depending on the language you use. Typical extensions will be .cs for C#, .vb for VB7 and .js for JScript.NET
To start with this example, choose a new Web Application project in Visual Studio.Net. Here I used C# project. Open Solution Explorer. In the design window of WebForm1.aspx, click on the tag HTML and add the following code.
The first line of the ASP.NET page is the page directive that specifies the name of the code behind file and the actual class name inside that file. In our example, the file name is WebForm1.cs and the class name is Reflect.WebForm1
Let us get into how to create the code behind file WebForm1.cs. Open the code window of WebForm1.aspx, you could see WebForm1.cs. Add the following event inside the class WebForm1.
Now, build the project, at this time the code behind file in this case, WebForm1.cs gets compiled. Now open WebForm1.aspx in browser. Enter your name and choose a category, then click the button, you would see the following.
Data Access Services In Microsoft.Net - ADO+
As the name implies, ADO+ evolves from ADO. ADO+ is designed to provide data access services for scalable Web-based applications and services. ADO+ provides high-performance stream APIs for connected, cursor-style data access, as well as a disconnected data model more suitable for returning data to client applications. Any data regardless of how it is actually stored – can be manipulated as XML or relational whichever is most appropriate for the application at a given point of time.
One of the major innovations of ADO+ is the introduction of the Dataset. Dataset is analogous to the concept of disconnected recordset in ADO. A Dataset is an in-memory data cache providing a relational view of the data. Datasets know nothing about the source of their data—the Dataset may be created and populated programmatically or by loading data from a data store. The System.Data namespace consists of the classes that constitute the ADO.NET architecture. The DataSetCommand class in the System.Data namespace provides functions that allows interfacing between data stores and Datasets.
An Example Illustrating How Data Is Persisted As XML In ADO+
MSDE is a data engine and does not have its own user interface for database design. So you need to adopt any of the following methods to create a database that can be utilized with MSDE.
- Create a new database using the SQL Server 7.0 Developer Edition, detach the database and attach the database to an MSDE server using SQL-DMO
- Create MSDE Databases using Access 2000 user interface
- Use the Visual Studio development environment. Developers can use Visual Basic to create a new custom application to distribute MSDE and build a database.
Interoperability Of COM Objects With .Net
The Microsoft .NET Framework provides the infrastructure to help you create .NET applications that interact with existing COM components, COM+ services, external type libraries, and many operating system services. By interoperating with existing code, you can preserve your current code base and upgrade at your own pace.
How .Net Object Differs From COM Object?
Net object will be associated with the metadata. But COM objects on the other hand, doesn’t store the metadata required by the .Net framework, so if we can add the metadata to the COM components then these components become accessible via .NET Framework.
Let us see how this is done with a simple example. First create a COM component with VB6. We are going to call the VB6 ActiveX DLL project CurrentDate, and the class name ClsCurrentDate. Next I added a public function called GetTodayDate, which will return the current date.
Let’s go ahead and compile the DLL file(CurrentDate.dll) and register it with Regsvr32 utility. Now let’s convert the COM object into a .Net aware object. For that, we need to use the command line utility tlbimp.exe file as follows
What TlbImp Do?
When you use tlbimp.exe, it creates an assembly called the Runtime Callable Wrapper(RCW). The RCW acts as a kind of proxy between the managed .NET code and unmanaged COM component.
The first parameter is the source COM DLL file name, the second being the destination file name. Once the conversion is done, let’s create a virtual directory in IIS 5.0. Create a BIN sub directory underneath the virtual directory and copy the converted DLL file (Net_CurrentDate.dll) into the directory.
Now let’s create an ASPX file to access the DLL file. The following code(CurrentDate.aspx) will fulfill this purpose
Let me discuss how this works. The first line in ASPX file is < %Import Namespace=”CurrentDate” %>. You will recall that VB6 DLL project name was CurrentDate – the .NET runtime can easily find the object because the component is already stored in the /BIN directory. Thus we are able to instantiate the COM dll and call methods in it.
Note: You can also deploy the component in the Global Assembly Cache, a global cache repository that stores all assemblies to be used by .Net applications using the tool gacutil.exe.
ASP.NET Web Services
You can think of a service as the execution of some business logic. A Web Service is simply an application delivered as a service that can be integrated with other Web Services using Internet standards. In other words, it's a URL-addressable resource that programmatically returns information to clients who want to use it. One important feature of Web Services is that clients don't need to know how a service is implemented. Here are some sample web services
- Converting a ZIP code to a latitude and longitude coordinate
- Validating a credit card purchase
- Getting directions from point A to point B
- Getting a restaurant’s menu, and so on…
The Web Service contract describes the services provided in terms of the messages the Web Service accepts and generates rather than how the service is implemented. By focusing solely on messages, the Web Services model is completely language, platform, and object model-agnostic. A Web Service can be consumed by applications implemented in any language for any platform.
The DISCO specification will describe a standard way for service providers to publish Web Service contracts and the corresponding mechanism that lets developers or developer tools discover contract documents.
Features Of .Net Web Services
- Unlike current component technologies Web Services do not use object model-specific protocols such as DCOM, RMI, or IIOP that require specific, homogeneous infrastructures on both the client and service machines but rather they communicate using ubiquitous Web protocols and data formats such as HTTP and XML. Any system supporting these Web standards will be able to support Web Services.
- Interoperability. The service can be consumed by any clients regardless of the platform or language.
- Since Web Services are based on open Internet standards, such as HTTP and XML, they can be consumed in devices like Pocket PCs, Mitsubishi T250 phone, Nokia 7110 phone and similar web enabled devices.
Secured .NET Web Service To Validate Credit Card Number
CreditCardValidationService is a secured web service which validates the Card Number of the following types of credit cards
VISA, MASTER, AMERICAN EXPRESS, AMEX, DISCOVER, JCB,
DINERS, CARTEBLANCHE, ENROUTE
This service takes the Credit Card Number and Credit Card type as input and returns a string denoting whether that is a valid card number. This web service is implemented in C#.
Build the project. The Web Service can now be invoked via HTTPS, and XML can be used to pass data to and from the service. You can test the Credit Card Validation Service directly from any type of browser that you'd like to use. This brings you a Web Page as shown in figure below, that lists the methods exposed in that service with the details of the input parameters, the return values and their data types.

Now you can very test your service, by entering value for the parameters and hitting the Invoke Button. As you can see in the figure below, the service is passing data back natively as XML.

XML Output
The CreditCardValidationService service could also have been created on any operating system, including flavors of Unix, with any Web server, including Apache. However, using Microsoft Windows 2000 and Internet Information Services (IIS) 5.0 will make creating and assembling these services very easy and automatic.
Simple Object Access Protocol - SOAP
SOAP provides a simple and lightweight mechanism for exchanging structured and typed information between peers in a decentralized, distributed environment using XML. It is a simple protocol that allows you to access an Object on the Net. SOAP can potentially be used in combination with a variety of protocols like HTTP, SMTP and so many other protocols.
Parts Of SOAP Message
SOAP consists of three parts
- The SOAP envelope construct defines an overall framework for expressing what is in a message; who should deal with it, and whether it is optional or mandatory.
- The SOAP encoding rules defines a serialization mechanism that can be used to exchange instances of application-defined datatypes.
- The SOAP RPC representation defines a convention that can be used to represent remote procedure calls and responses
Examples Of SOAP Messages
In this example, a IsValidUser SOAP request is sent to a CheckUser service. The request takes two string parameters, userid and password, and returns a string result in the SOAP response. The SOAP Envelope element is the top element of the XML document representing the SOAP message. XML namespaces are used to disambiguate SOAP identifiers from application specific identifiers.
SOAP Message Embedded In HTTP Request
SOAP Message Embedded in HTTP Response
Relation To XML
All SOAP messages are encoded using XML
A SOAP application should include the proper SOAP namespace on all elements and attributes defined by SOAP in messages that it generates. A SOAP application MUST be able to process SOAP namespaces in messages that it receives. It MUST discard messages that have incorrect namespaces and it MAY process SOAP messages without SOAP namespaces as though they had the correct SOAP namespaces.
SOAP defines two namespaces
- The SOAP envelope has the namespace identifier
http://schemas.xmlsoap.org/soap/envelope/ - The SOAP serialization has the namespace identifier
http://schemas.xmlsoap.org/soap/encoding/
What SOAP Does?
SOAP messages are fundamentally one-way transmissions from a sender to a receiver, but often SOAP messages are combined to implement patterns such as Request/Response.
Soap defines an XML structure to call a method and pass that method parameters.
Soap also defines an XML structure to return values that were requested.
Soap defines an XML structure to return error values (faults) if the service provider can not execute the requested method.
What SOAP Doesn’t Takes Care Of?
The current SOAP1.1 specification doesn’t speak about the following issues. Distributed garbage collection Box carring or batching of messages Objects-by-reference (which requires distributed garbage collection) Activation (which requires objects-by-reference).
Advantages Of SOAP
SOAP provides a platform-independent way to call methods located on diverse distributed systems.
Since it uses port number 80, which is the default port number for HTTP, it is Firewall friendly. So unlike other protocols like DCOM, which uses dynamic port it can be caught into firewalls.
Since SOAP is XML-based it is lightweight and easy to understand.
Advantages Of .Net
A standard way to access data and merge multiple data sources into one view. By standardizing how requests are made of various Web services, and how data is moved between these services, you should be able to grab data from multiple locations and display or manipulate it in a manner consistent with what your user expects.
An end to multiple synching of devices. If you have a Palm handheld device, a CE device, a notebook, and a digital phone, you are forever keeping your contact list (and other things) in synch between them all. .NET promises to minimize this requirement by letting you store your information in one place, with all devices accessing the same information when needed.
A higher-level approach to development. Microsoft is binding the core functionality of the .NET platform into the operating system, and providing the means for any language to address this Common Language Runtime (CLR). This will let any language use the components of any other (like COM), and even inherit from components in other languages. They should also all have the same basic capabilities, letting you use the language you prefer. Through the use of SOAP and BizTalk, Microsoft is moving to a visual means of defining business processes and binding the steps of that process to various Web services that are available. The process information becomes an XML stream that can be changed without modifying source code.
.NET applications are intended to provide a unified interface so that users can browse, edit, and create documents from a single application. The data model should make the applications capable of pulling together data from multiple sources into a single viewable document. Users should be able to access their applications, personal settings, and data from any device with a compatible browser.
Conclusion – The .Net Revolution
Microsoft .NET will make computing and communicating simpler and easier than ever if it is able to be fully developed, implemented and utilized. Microsoft Dot net Technology enable world in which people could connect with the information they wanted, when they wanted it, from whatever device they wanted.
It will spawn a new generation of Internet services, and enable tens of thousands of software developers to create revolutionary new kinds of online services and businesses. It will put you back in control, and enable greater control of your privacy, digital identity and data. And software is what makes it all possible.
