Friday, 14 June 2013

WEB SERVICES IN ASP.NET

        WEB SERVICES

 Web Service: 

A web service is a web based functionality that we access using the protocols of the web.
The goal of the web service is to create web based applications that interact with other applications with no user interface.
Thus Web Service is an application that is designed to interact directly with other applications over the internet. In simple sense, Web Services are means for interacting with objects over the Internet.
Web Service is
Ø  Language Independent
Ø  Protocol Independent
Ø  Platform Independent
Ø  It assumes stateless service architecture.

WEB SERVICE HISTORY :

As  Web Service is nothing but means for Interacting with objects over the Internet.
1. Initially Object - Oriented Language comes which allow us to interact with two object within same application.
2.Component Object Model (COM) which allows to interact two objects on the same computer, but in different applications.
3. Distributed Component Object Model (DCOM) which allows to interact two objects on different computers, but within same local network.
4. And finally the web services, which allows two object to interact internet. That is it allows to interact between two object on different computers and even not within same local network.

 Web Service Architecture

There are two ways to view the web service architecture.
·         Web service roles
·         Web service protocol stack.



1. Web Service Roles

There are three major roles within the web service architecture:
  • Service provider:
This is the provider of the web service. The service provider implements the service and makes it available on the Internet.
  • Service requestor
This is any consumer of the web service. The requestor utilizes an existing web service by opening a network connection and sending an XML request.
  • Service registry
This is a logically centralized directory of services. The registry provides a central place where developers can publish new services or find existing ones. It therefore serves as a centralized clearinghouse for companies and their services.


2. Web Service Protocol Stack

A second option for viewing the web service architecture is to examine the emerging web service protocol stack. The stack is still evolving, but currently has four main layers.
  • Service transport
This layer is responsible for transporting messages between applications. Currently, this layer includes hypertext transfer protocol (HTTP), Simple Mail Transfer Protocol (SMTP), file transfer protocol (FTP), and newer protocols, such as Blocks Extensible Exchange Protocol (BEEP).
  • XML messaging
This layer is responsible for encoding messages in a common XML format so that messages can be understood at either end. Currently, this layer includes XML-RPC and SOAP.
  • Service description
This layer is responsible for describing the public interface to a specific web service. Currently, service description is handled via the Web Service Description Language (WSDL).
  • Service discovery
This layer is responsible for centralizing services into a common registry, and providing easy publish/find functionality. Currently, service discovery is handled via Universal Description, Discovery, and Integration (UDDI).

Web Services Technologies

Web service architecture involves many layered and interrelated technologies. There are many ways to visualize these technologies, just as there are many ways to build and use Web services. Figure  below provides one illustration of some of these technology families.


XML  :

Ø XML solves a key technology requirement that appears in many places. By offering a standard, flexible and inherently extensible data format, XML significantly reduces the burden of deploying the many technologies needed to ensure the success of Web services.
Ø The important aspects of XML, for the purposes of this Architecture, are the core syntax itself, the concepts of the XML Info set, XML Schema and XML Namespaces.
Ø XML Infoset is not a data format , but a formal set of information items and their associated properties that comprise an abstract description of an XML document . The XML Infoset specification provides for a consistent and rigorous set of definitions for use in other specifications that need to refer to the information in a well-formed XML document.

SOAP

Ø SOAP  provides a standard, extensible, composable framework for packaging and exchanging XML messages. In the context of this architecture, SOAP 1.2 also provides a convenient mechanism for referencing capabilities (typically by use of headers).
Ø SOAP  defines an XML-based messaging framework: a processing model and an exensibility model. SOAP messages can be carried by a variety of network protocols; such as HTTP, SMTP, FTP, RMI/IIOP, or a proprietary messaging protocol.
Ø SOAP  defines three optional components: a set of encoding rules for expressing instances of application-defined data types, a convention for representing remote procedure calls (RPC) and responses, and a set of rules for using SOAP with HTTP/1.1.

WSDL

Ø WSDL is a language for describing Web services.
Ø WSDL describes Web services starting with the messages that are exchanged between the requester and provider agents. The messages themselves are described abstractly and then bound to a concrete network protocol and message format.
Ø Web service definitions can be mapped to any implementation language, platform, object model, or messaging system. Simple extensions to existing Internet infrastructure can implement Web services for interaction via browsers or directly within an application. The application could be implemented using COM, JMS, CORBA, COBOL, or any number of proprietary integration solutions. As long as both the sender and receiver agree on the service description, (e.g. WSDL file), the implementations behind the Web services can be anything.

UDDI :

UDDI is a platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet.
Ø  UDDI stands for Universal Description, Discovery and Integration
Ø  UDDI is a directory for storing information about web services
Ø  UDDI is a directory of web service interfaces described by WSDL
Ø  UDDI communicates via SOAP

Ø  UDDI is built into the Microsoft .NET platform

Wednesday, 5 June 2013

ACCESS MODIFIERS IN C#


ACCESS MODIFIERS IN C# 

There are five access modifiers in C # :

1. PRIVATE 2. PUBLIC 3. PROTECTED 4. INTERNAL 5. PROTECTED INTERNAL 


ACCESS MODIFIERS
ACCESSIBILITY
PRIVATE
ONLY WITH THE CONTAINING CLASS
PUBLIC
ANYWHERE…NO RESTRICTIONS
PROTECTED
WITHIN THE CONTAINING   TYPES  AND THE TYPES DERIVED FROM THE CONTAINING  TYPE.
INTERNAL
ANYWHERE IN THE CONTAINING ASSEMBLY
PROTECTED INTERNAL
ANYWHERE IN THE CONTAINING ASSEMBLY AND FROM WITHIN THE DERIVED CLASS IN ANY OTHER ASSEMBLY.

RATIONAL UNIFIED PROCESS (RUP)


RATIONAL UNIFIED PROCESS (RUP) 

Rational Unified Process (RUP) : 

The rational unified process is defined as the process of software engineering which presents the iterative framework. Its main function is to manage object oriented software development.


Ø Develop software iteratively.
Ø Manage requirements.
Ø Use component-based architectures.
Ø Visually model software
Ø Continuously verify software quality.
Ø Control changes to software. 


RATIONAL UNIFIED PROCESS (RUP)




Four Process Phases : 
 Inception Phase
 Elaboration Phase
 Construction Phase
 Transition Phase

Inception Phase : 
INCEPTION PHASE


Elaboration Phase : 

ELABORATION PHASE




Construction Phase : 

CONSTRUCTION PHASE


Transition Phase : 

TRANSITION PHASE


Tuesday, 28 May 2013

ASP.NET Page Life Cycle Events

ASP.NET Page Life Cycle Events

 The page life cycle events are :

                    

PreInit 


Init


InitComplete

PreLoad


Load


ControlEvents


LoadComplete

PreRender


PreRenderComplete


SaveStateComplete


RenderComplete

Unload



PreInit  : 

This is the initial stage of the page means this is entry point  of page life cycle .
This  checks for is PostBack that means  first time the request is sent or the first time page is processed. Dynamic controls are created in this event such as:
To Set master page dynamically.
To Set the Theme property dynamically,
To Read or set profile property values.


Init:
In this Init Event for the individual control is initialised first  and later the init for the page takes place. This  event is used to initialize the control properties i.e. Each control in the control collection is initialized.

InitComplete:
 View State is turned on in this event . Any changes made to the View State in this event are persisted even after the next postback. In simple sense page is initialised  and  process completes. 

PreLoad:
This event is called before the loading of the page is completed.


Load:
This Load means that all the controls have been loaded completely .  This implies that the  control properties and the view state can be accessed at this point/cycle.
This works like initially ,   the Page Object calls the OnLoad method on the Page object itself  and  then OnLoad method of the control is called .  This means that the Load event of Page occurs before Load event of the controls . 

ControlEvents:
This event manages the events for the buttons , textboxes etc  Like button click event , textbox : textchange event .
In the case of postback , the Page.Isvalid property checks  if the page contains validator controls . 

LoadComplete :
This means that the page has been loaded in the memory. It also marks the beginning of the rendering stage and occurs after the event handling stage. This event is used for tasks such as loading all other controls on the page.

PreRender:
If you need to make any final changes /modification  to the contents of the controls or the page, then we use this event. In this event the PreRender event of the page is called first and later for the child control.

    For eg : To set  the DataSourceId Property  and calling the DataBind method.

PreRenderComplete:
This event is raised after each control's PreRender property/phase  is completed.

SaveStateComplete:
In this event, the current state of the control is completely saved to the ViewState.This is raised after the control state and view state have been saved for the page and for all controls.


RenderComplete:
     The page object calls this method on each control which is present on the page.   This method writes the control’s markup to send it to the browser. 

Unload:
This event is typically used for closing files and database

 connections. 

Friday, 24 May 2013

CONCEPT OF OOPS (Object-Oriented Programming )

CONCEPT OF OOPS -OBJECT ORIENTED PROGRAMMING  

What is Abstraction,Encapsulation,Inheritance,Polymorphism?

  •   ABSTRACTION: Abstraction means to show only the necessary details and hiding non essential features. Abstraction is done when we need to inherit from certain class but do not instantiate the objects of that class. 
  •   ENCAPSULATION  : Encapsulation is wrapping/binding up of data and member functions  in single unit. 
In simple, abstraction is hiding the implementation and encapsulation is to hide data.
  •   INHERITANCE   : Inheritance  enables you to create new classes   that reuse ,extend  and modify the behaviour that is defined in other classes.  In simple terms when one class inherit the  properties , methods etc. of the other class is known as inheritance.  The class whose members are inherited are called base class and other class is known as derived class . 
      for eg : using system ;
                    public class baseclass{
                   public class baseclass( ) 
                   { console.writeline("this is base class constructor");}
                   public void  hello( )
                  { console.writeline("this is baseclass");}
                   }
                   public class derivedclass: baseclass
                    {public dervedclass(  )
                    console.writeline("this is derivedconstructor");
                    }
                    public static void main( )
                    { derivedclass obj = new derivedclass();
                      obj.hello( ); 
                     }
 OUTPUT : this is baseclass constructor 
         this is  derived constructor
         this is   baseclass 
    
                    

  •   POLYMORPHISM  : When an object exhibits different  behaviour in different situation. In simple way  when a message  can be processed in different ways/forms .   

      Polymorphism is of two types : Compile time polymorphism   (this is concept   

      of  OVERLOADING).      

    Runtime Polymorphism : (this is concept of OVERRIDING).

Sunday, 12 May 2013

HOW TO READ CONNECTION STRING FROM WEB.CONFIG FILES

HOW TO READ CONNECTION STRING  FROM WEB.CONFIG FILES ?


CONFIGURATION MANAGER IS USED TO READ CONNECTION STRING FROM WEB.CONFIG FILE.


For eg : 

 protected void Page_Load (...)          

 { con.ConnectionString = ConfigurationManager.ConnectionString["cn"].ConnectionString; //some code // }



CONNECTION STRING IN ASP.NET AND SQL SERVER

CONNECTION STRING IN ASP.NET 

When a connection is formed between  SQL Server  and ASP.NET  in that case  string  is generated which is known as connection string .

Connection String should be written in that file which does not compile. (the non-compiled file is web.config )


Connection String on Web.Config File : 


<?xml version="1.0"?>

<configuration>

    <system.web>
        <compilation debug="false" targetFramework="4.0" />

    </system.web>
  <connectionStrings>
    <add name="cn"    connectionString="server=servername/instancename;Database=databasename;uid=sa;
     pwd=123 " />
  </connectionStrings>
</configuration>