Whitepapers
Product Development

Calsoft Labs is a leading technology partner for companies, helping them develop new products and modernize existing ones using emerging technologies. more

Download PDF: Microsoft.Net and SOAP Bookmark and Share

Microsoft.Net and SOAP

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.

Click here to go to Top

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.

.NET Framework 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.

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

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)

Click here to go to Top

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.

Click here to go to Top

How can I produce an assembly?

For example, the following C# program:

Source file: clsasm.cs

  public class clsasm
   {
	public clsasm()
	{
	System.Console.WriteLine( "Learning Assemblies" );
	}
  }

can be compiled into a library assembly (dll) like this:

 csc /t:library clsasm.cs
 

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.

clsasm.dll

metadata or assembly manifest associated with the assembly clsasm.dll

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.

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

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.

To list the Files in a Folder Using Win Form Application

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.

Components that are added to Form1 from the Toolbox

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)

{
Directory exploredir = new Directory(this.txtDir.Text);
string dirname = exploredir.Name;
string fullpath = exploredir.FullName;
string isdir = exploredir.IsDirectory.ToString();
string isfile = exploredir.IsFile.ToString();
this.lstFileList.Items.Add("Folder Name :  "+dirname);
this.lstFileList.Items.Add("Full Path   :  "+fullpath);
this.lstFileList.Items.Add("Is Directory :  "+isdir);
this.lstFileList.Items.Add("Is File      :  "+isfile);
this.lstFileList.Items.Add("");
this.lstFileList.Items.Add("Files contained 
	in this Folder: ");
File[] childfiles = exploredir.GetFiles();
foreach (File childfile in childfiles)
{
	this.lstFileList.Items.Add(" "+ childfile.Name);
}
this.lstFileList.Items.Add("");
this.lstFileList.Items.Add("Subfolders contained in this
          Folder: ");
Directory[] childfolders = exploredir.GetDirectories();
foreach(Directory childfolder in childfolders)
{
	this.lstFileList.Items.Add(" "+childfolder.Name);
}			
}

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 textbox

Web Application Model

Web Application model encompasses both Web applications that generate pages for display in a browser and Web Services.

Click here to go to Top

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.

Click here to go to Top

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.
  • 1. 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.

Click here to go to Top

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

 < %
 @ Page language="c#" Codebehind="WebForm1.cs" 
 AutoEventWireup="false" Inherits="Reflect.WebForm1" %>

The namespace that I used for this code behind page is Reflect.


Top of Form
Top of Form
< %@ Page language="c#" Codebehind="WebForm1.cs" 
AutoEventWireup="false" Inherits="Reflect.WebForm1" %>	
< html>
< body>
< form action="WebForm1.aspx" method="post" runat="server" 
ID=Form1>


     < h2> Name:< asp:textbox id="Name" runat="server"/>
     Category:  < asp:dropdownlist id="Category" runat=server>
         < asp:listitem>psychology< /asp:listitem>
         < asp:listitem>business< /asp:listitem>
         < asp:listitem>popular_comp< /asp:listitem>
         < /asp:dropdownlist>

< asp:button type=submit text="Lookup" 
OnClick="SubmitBtn_Click" runat="server" ID=Button1/>

			< br>< br>
         < asp:label id="Message" runat="server"/>
      < / form>
   < /body>
< /html>

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.

protected void SubmitBtn_Click(Object sender, EventArgs e) 
{
Message.Text = "Hi " + Name.Text + ", you selected: " +       
                                   Category.SelectedItem;
}

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.

ASP.NET code output in Web Pages

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

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.

Public Function GetTodayDate() As Date
GetTodayDate = Now
End Function

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:

TlbImp CurrentDate.dll /out: Net_CurrentDate.dll

Click here to go to Top

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

< %@Import Namespace="CurrentDate"%>
< html>
< head>
< Title> Accessing COM objects from .Net Framework
< /Title>
< /head>
< body>

< script language = "vb" runat="server">
Sub Page_Load(Sender as Object, E as EventArgs)
dim COMobj as new ClsCurrentDate
lblCOMData.Text = COMobj.GetTodayDate
COMobj = Nothing
End Sub
< /script>
< form runat = "server">
< p>< FONT face = "Verdana, Arial" size = 2>
< B> Accessing COM objects from .Net Framework 
< /B>< /FONT>< HR>< /P>
Today's Date from COM: 
< asp:Label id = "lblCOMData" runat = "server"/>
< /form>
< /body>
< /html>            

Accessing COM objects from .net framework

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.

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

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#.

Source Code in C#: (WebService1.asmx)

namespace CreditCardValidationService
{
	using System;
	using System.Collections;
    using System.Configuration;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Web;
    using System.Web.Services;
    
    public class WebService1 : System.Web.Services.WebService
    {
		 public WebService1()
        {
            InitializeComponent();
        }
        private void InitializeComponent()
        
        {
        }
        public override void Dispose()
        {
        }
        private System.Boolean isCreditCard(string st)
	  {
		if(st.Length>19) return(false); 
		int sum=0;
		int mul=0;
		int l=st.Length;
		for(int i=0;i<1;i++)
		{
	string digit=st.Substring(l-i-1,1);
			int tproduct=(digit.ToInt32())*mul;
			if(tproduct>=10)
			{
				sum+=(tproduct%10)+1;
      	      }
			else
			{
				sum=sum+tproduct;


			}
			if (mul==1)mul++;
			else mul--;
		}
		if ((sum%10)==0)return(true);
		else return(false);
	}
private System.Boolean isVisa(string cc)
	{
		if(((cc.Length==16)||(cc.Length==13))&& 
(cc.Substring(0,1)=="4"))
		{
			return isCreditCard(cc);
		}
		return false;
	}
	private System.Boolean isMasterCard(string cc)
	{
		string firstdig = cc.Substring(0,1);
		string seconddig = cc.Substring(1,2);
		int sec=seconddig.ToInt32();
		
		


if ((cc.Length == 16) && (firstdig == "5") && ((sec >= 1) && 
	(sec <= 5))) return isCreditCard(cc);
	
	return false;
	
	}
	private System.Boolean isAmericanExpress(string cc)
	
	{
		string firstdig = cc.Substring(0,1);
		string seconddig = cc.Substring(1,2);
if ((cc.Length == 15) && (firstdig =="3") && 
	((seconddig =="4") || (seconddig =="7"))) 
	
	 return isCreditCard(cc);
	
	return false;
	}
	private System.Boolean isDinersClub(string cc)
	{
		string firstdig = cc.Substring(0,1);
		string seconddig = cc.Substring(1,2);
if ((cc.Length == 14) && (firstdig == "3") && 
	((seconddig == "0") || (seconddig == "6") || 
	(seconddig == "8"))) 
	
		return isCreditCard(cc);
		return false;
	}
	private System.Boolean isCarteBlanche(string cc)
	{
	return isDinersClub(cc);
	}
	private System.Boolean isDiscover(string cc)
	{
		string first4digs = cc.Substring(0,4);
if ((cc.Length == 16) && (first4digs == "6011"))
	return isCreditCard(cc);
		return false;
		
		
}
	private System.Boolean isEnRoute(string cc)
	{
		string first4digs = cc.Substring(0,4);
		
if ((cc.Length == 15) && ((first4digs == "2014") || 
(first4digs == "2149"))) return isCreditCard(cc);
		
		return false;
	}
	private System.Boolean isJCB(string cc)
	{
		string first4digs = cc.Substring(0,4);
if	((cc.Length == 16) &&	 ((first4digs == "3088") || 
	(first4digs == "3096") || (first4digs == "3112") || 
	(first4digs == "3158") || (first4digs == "3337") || 
	(first4digs == "3528"))) 

return isCreditCard(cc);
		return false;
	}
	private System.Boolean isAnyCard(string cc)
	{
	if (!isCreditCard(cc)) return false;
	
if (!isMasterCard(cc) && !isVisa(cc) && !isAmericanExpress(cc) 
	&& !isDinersClub(cc) && !isDiscover(cc) 
	&& !isEnRoute(cc) && !isJCB(cc)) 
	
return false;
		return true;
	}
	[WebMethod]
   public string isCardMatch (string cardType,string cardNumber)
	{
	     cardType = cardType.ToUpper();
 	     System.Boolean doesMatch = true;
 	     
if ((cardType == "VISA") && (!isVisa(cardNumber))) 
	doesMatch = false;
	
if ((cardType == "MASTER") && (!isMasterCard(cardNumber))) 
	doesMatch = false;
	
if (((cardType == "AMERICAN EXPRESS") || (cardType == "AMEX"))
	 && (!isAmericanExpress(cardNumber))) 
		doesMatch = false;
		
if ((cardType == "DISCOVER") && (!isDiscover(cardNumber))) 
	doesMatch = false;
	
if ((cardType == "JCB") && (!isJCB(cardNumber))) 
doesMatch = false;

if ((cardType == "DINERS") && (!isDinersClub(cardNumber))) 
	doesMatch = false;
	
if ((cardType == "CARTEBLANCHE") && (!isCarteBlanche(cardNumber))) 
	doesMatch = false;
	
if ((cardType == "ENROUTE") && (!isEnRoute(cardNumber))) 
	doesMatch = false;

if (doesMatch==true)
	      
	{
	return("The Given Credit Card Number is valid");
	}
	else	

	return("Not a valid Credit Card");
	
	}
    }
	}
		
	
        


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.

Web service

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

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.

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

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.

Click here to go to Top

SOAP Message Embedded in HTTP Request

POST /mysamples1/User/CheckUser.asmx HTTP/1.1
SOAPAction: http://tempuri.org/IsValidUser
Content-Type: text/xml
Content-Length: 448
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; 
Windows NT 5.0; COM+ 1.0.2204)
Host: muma:8080
Connection: Keep-Alive

< ?xml version="1.0"?>

< SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org
/soap/envelope/" 
xmlns:soapspenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/1999/XMLSchema">

< SOAP:Body>
< IsValidUser xmlns="http://tempuri.org/">
< userid xmlns="http://tempuri.org/">199< /userid>

< passwordxmlns="http://tempuri.org/">uma< /password>
< /IsValidUser>
< /SOAP:Body>
< /SOAP:Envelope>

Click here to go to Top

SOAP Message Embedded in HTTP Response

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 12 Feb 2001 05:37:01 GMT
Cache-Control: private, max-age=0
Content-Type: text/xml
Content-Length: 407

< ?xml version="1.0"?>
< soap:Envelope xmlns:soap="http://schemas.xmlsoap.org
/soap/envelope/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  < soap:Body>
  < IsValidUserResult xmlns="http://tempuri.org/">
  < result>true< /result>
  < /IsValidUserResult>
  < /soap:Body>

< /soap:Envelope>

Click here to go to Top

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 serialization has the namespace identifier
  • http://schemas.xmlsoap.org/soap/encoding/

    Click here to go to Top

    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.

    Click here to go to Top

    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)

    Click here to go to Top

    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.

    Click here to go to Top

    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.

    Click here to go to Top

    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.

    Click here to go to Top

    Microsoft .NET Resources

    Dot Net

    ASP.Net

    XML

    Click here to go to Top