Pages

Men

rh

6/19/2012

Web Service in Asp.Net

Web Service:-
A Component assembled  from programmable application logic that can be accessed using standard web protocols.

What are Web Service:-
  • Web Service are application components.
  • Web Service communicate using Open Protocols.
  • Web Service are self - contained and self describing.
  • Web service can be discovered using  UDDI.
  • Web Service can be used by other applications.
  • XML is the basis for Web Service.
XML Provides a language which can be used between plat forms and programming languages.

Web service plat form elements.
  • SOAP
  • UDDI
  • WSDL.
A Web service uses XML to code and decode your data and SOAP to transport is using open protocols.

SOAP:- Simple Object Access Protocol.
  • It is core protocol for web service. It is an web standard used to call the remote method on a server hosting web service.
  • It specifies both the format of method request and format of parameter passed in the message.  It contains a set of serialization rules enabling the sending and receiving of the correct information.
  • If both the client and server send a valid SOAP message, each can be written different languages and reside on completely different systems, the server could be J2EE and client could be dotnet windows application, SOAP act as neutral protocol for them to communicate.
  • SOAP message must be encoded using XML.
  • SOAP message must use the SOAP envelope namespace.
  • SOAP message must use the SOAP encoding name space.
  • SOAP message must not contain a DTD reference.
  • SOAP message must not contain XML processing instructions.

SOAP can be one of  three types.
  • Method Call
  • Response Message
  • Fault Message
Method Call:-
A Method call is single request for a method invocation on  a remote server. It contains name of the method to invoke as well as any parameters required for the method.

Response Message:-
A Response Message returned from the Web service with the result of the method call.

Fault Message:- 
A Fault Message is a special type of response message generated if the remote object throws an exception.

A SOAP Message is comprised of the following parts.
  • A SOAP Envelope
  • An Optional SOAP header
  • SOAP Body
<SOAP envelope element is the root element of SOAP message.The use of XMLNS: SOAP namespace is , it always contains the value of
"http://www.w3ordg/2010/12/SOAP Envelope:"

Example of SOAP Envelope:

<XML Version = "1.0">
   <SOAP: Envelope
        Xmlns:SOAP="http://www.w3ordg/2010/12/SOAP-Envelope:"
        SOAP: Encoding Style ="http://www.w3ordg/2010/12/SOAP -Encoding:">
   ------
   -----
</SOAP: Envelope>

Encoding Style Attribute:-
This is used to define the data types used in the document. This attribute may appear on any SOAP element  and it will apply to that element content  and all child elements.

SOAP Header:-
It contains application specific information like authentication, payment etc about the SOAP message.

The Action Attribute:
This is used to address the header element to a particular end point

SOAP Body:- It contains actual SOAP Message.

SOAP Faults:-
  • The optional SOAP element and it is used to hold error and status information for a SOAP message.
  • An error message from a SOAP message is carried inside  fault element.
  • If the fault element is present, it must appear as a child element of the body element.
  • A Fault element can only appear once in a SOAP message.
Sub Elements of SOAP Faults:-
  • Fault Code
  • Fault string
  • Fault Actor
  • Details
WSDL:- Web service Description Language:-

  • This is designed to describe a web service and all of its methods. This is done in XML.
  • In a WSDL document all of its parameters and method names of web service are specified.
  • WSDL is a standardized protocol. Just like an SOAP so any system can interpret the Web service's method and understand what SOAP messages to generate and send.
  • The WSDL file is used to create  a proxy object that can communicate with the external web service.
  • .Net provides WSDL.exe to create  a proxy object given a WSDL document.
  • WSDL is extensible and new bindings can ab added to a web service to allow for message to be sent via multiple protocol.
WSDL Document Structure:-
  • Port Type
  • Message
  • Types
  • Binding
Main Structure of WSD;-

<definitions>
     <types>
          . . . . . .
          . . . . . .
     </types>
     <Message>
         . . . . . .
         . . . . . .
    </Message>
     <Porttype>
        . . . . . .
     </Porttype>
     <Binding>
        . . . . . .
     </Binding>
</definitions>

WSDL Ports:-
Operation is performed by Web service.

Messages:-
Messages are used by Web Service

Types:-
The Data types are used by Web Service

Bindings:-
Communication protocols used by the Web Serive.
Binding element can be classified into two attributes.
  • Name Attribute
  • Type Attribute
Name Attribute:- 
It defines the name of the bindings.
Type Attribute:-
It points to the port of the bindings.

UDDI:- (Universal Description Discovery and Integration)

It represents the technical specification and publishing  and finding the information. The information in Web service falls in to 3 categories.

  • White Pages information
  • Yellow pages information
  • Green Pages information

White Pages information:- 
It contains general information about the company.
Ex:- URL of Wen Service, Company Name and Address.


Yellow Pages:-
It includes general classification of data either company name or service offered.

Green Pages information:-
It describes service offered by Web Service.





















No comments :

Post a Comment