Labels

Monday, July 7, 2008

01 - Understanding Web Services

Overview of XML Web Services:

In Web Services: The data related to the method call and to the arguments is sent to the Web service in XML format using the SOAP protocol over the HTTP transport.

· Method call and to the arguments is sent to the Web service in XML format using the SOAP protocol

· The Transport Protocol is HTTP.

· XML Web services use XML-based messaging to send and receive data, which enables heterogeneous applications to interoperate with each other.

· XML Web services can be used to integrate applications that are written in different programming languages and deployed on different platforms.

· In addition, you can deploy XML Web services within an intranet as well as on the Internet

XML Web Services Infrastructure:

The XML Web services infrastructure provides several components, that enable client applications to locate and consume XML Web services. These components include the following:

· XML Web services Directories.

o These directories / directory services provide a central place to Store Published Information about XML Web services. These directories might also be XML Web services.

o Microsoft provides one such directory service, which is located at http://uddi.microsoft.com

o The UDDI specifications define the guidelines for publishing information about XML Web services. As per the guidelines, the XML schemas associated with UDDI define four types of information that you must publish to make your XML Web service accessible.

o This information includes

§ Business Information,

§ Service Information,

§ Binding Information, and

§ Service Specifications.

o UDDI defines an API for interacting with a centralized Web Service information repository. Developers can register their services with a UDDI site, and other developers can query the site to find info. In order to support richer, more specific lookups, a UDDI site holds much more information than simply the WSDL document.

o UDDI is an industry-wide initiative that defines a SOAP-based protocol for updating and querying Web Service information repositories

· XML Web services Discovery.

o Using this process, clients locate the documents (Their Presence and Location) that describe an XML Web service using WSDL.

o DISCO is a Microsoft technology and introduced in .Net , for publishing and discovering Web Services.

· XML Web services Description.

o This component provides information that enables you to know which operations to perform on an XML Web service.

o The XML Web service description is an XML document, that specifies the format of messages that an XML Web service can understand. For example, the description document specifies the SOAP message schemas that you use when invoking methods on an XML Web service.

· XML Web service Wire Formats.

o Open wire formats are the protocols, such as HTTP and SOAP, that can be understood by any system that is capable of support- ing common Web standards.

o To enable communication between disparate systems, XML Web services use such open wire formats.

o The HTTP-GET and HTTP-POST protocols are the standard Web protocols that allow you to send parameters as name-value pairs.

o The HTTP-GET protocol allows you to send URL-encoded parameters as name-value pairs to an XML Web service.

o The HTTP-POST protocol to URL-encode and pass parameters inside the actual request message to the XML Web service as name-value pairs, and not appended to the URL.

o The SOAP protocol allows you to exchange structured and typed information between the applications on the Internet. The SOAP protocol consists of four parts.

§ SOAP Envelope - The envelope contains the message. This is the basic unit of exchange between the processors of SOAP messages. (Mandatory)

§ Data Encoding Rules - Used to encode application-specific data types.

§ Request/Response Pattern – Defines the pattern of message exchanges between XML Web services.

§ Bindings - Between the SOAP and HTTP protocols.

See below how above various components of the XML Web services infrastructure enable clients to Locate And Call methods on XML Web services.

Finding Steps:

· Client accesses a UDDI service to locate an XML Web service (.asmx).

· UDDI service returns a URL to the discovery document (.disco) of the XML Web service.

· After the client receives the URL to the discovery document, the client makes a request to the server using the URL.

· The Server which returns the discovery document (.disco) to the client.

· The client uses the information (path to the WSDL file)in the discovery document and makes a request to the server.

· The server returns the service description (.wsdl file) of an XML Web service. The service description is a .wsdl file and enables a client to interact with an XML Web service.

· Once the client recieves the link to WSDL, it provides option to Add reference, which in turn creates a Proxy class.

· Now see below the process involved, when a client invokes methods on a Proxy class.

A discovery document is a .disco file, which contains the link to the .wsdl file that describe an XML Web service. The contents of a sample discovery document are shown in the following code.

<?xml version="1.0" ?> 
<disco:discovery xmlns:disco="http://schemas.xmlsoap.org/disco" 
    xmlns:wsdl="http://schemas.xmlsoap.org/disco/wsdl"> 
    <wsdl:contractRef ref="http://www.contoso.com/MyWebService.asmx?WSDL"/> 
</disco:discovery>

Cleint à Call on Proxy à Serialize à Soap Message à Encrypt à Sent to Server

Server à Decrypt à Deserialize à Actual WebService Object à Execute the Method

Server à Call on Proxy à Serialize à Soap Message à Encrypt à Sent to Server

Client à Decrypt à Deserialize à Return value to ProxyObject -> ProxyObjec sends value to Client

· The client calls a method on the proxy object.

· The XML Web services infrastructure on the client system Serializes the method call and arguments into a SOAP message and sends it to the XML Web service over the network.

· The infrastructure on the server on which the XML Web service resides deserializes the SOAP message and creates an instance of the XML Web service.

· The infrastructure then calls the method with the arguments on the XML Web service.

· The XML Web service executes the method and returns the value with any out parameters to the infrastructure

· The infrastructure serializes the return value and any out parameters into a SOAP message and sends them to the client over the network.

· The infrastructure on the client computer deserializes the SOAP message containing the return value and any out parameters and sends them to the proxy object.

· The proxy object sends the return value and any out parameters to the client.

Thanks & Regards,

Arun Manglick || Senior Tech Lead

No comments:

Post a Comment