WP - I Unit-V IT
WP - I Unit-V IT
WP - I Unit-V IT
XML:
XML stands for Extensible Markup Language. It is a text-based markup language derived
from Standard Generalized Markup Language (SGML).
XML tags identify the data and are used to store and organize the data, rather than
specifying how to display it like HTML tags, which are used to display the data. XML is not
going to replace HTML in the near future, but it introduces new possibilities by adopting
many successful features of HTML.
There are three important characteristics of XML that make it useful in a variety of systems
and solutions −
• XML is extensible − XML allows you to create your own self-descriptive tags, or
language, that suits your application.
• XML carries the data, does not present it − XML allows you to store the data
irrespective of how it will be presented.
• XML is a public standard − XML was developed by an organization called the
World Wide Web Consortium (W3C) and is available as an open standard.
XML Usage
A short list of XML usage says it all −
• XML can work behind the scene to simplify the creation of HTML documents for
large web sites.
• XML can be used to exchange the information between organizations and systems.
• XML can be used for offloading and reloading of databases.
• XML can be used to store and arrange the data, which can customize your data
handling needs.
• XML can easily be merged with style sheets to create almost any desired output.
• Virtually, any type of data can be expressed as an XML document.
What is Markup?
XML is a markup language that defines set of rules for encoding documents in a format that
is both human-readable and machine-readable. So what exactly is a markup
language? Markup is information added to a document that enhances its meaning in certain
ways, in that it identifies the parts and how they relate to each other. More specifically, a
markup language is a set of symbols that can be placed in the text of a document to
demarcate and label the parts of that document.
Following example shows how XML markup looks, when embedded in a piece of text −
<message>
<text>Hello, world!</text>
</message>
This snippet includes the markup symbols, or the tags such as <message>...</message> and
<text>... </text>. The tags <message> and </message> mark the start and the end of the
XML code fragment. The tags <text> and </text> surround the text Hello, world!.
Is XML a Programming Language?
A programming language consists of grammar rules and its own vocabulary which is used to
create computer programs. These programs instruct the computer to perform specific tasks.
XML does not qualify to be a programming language as it does not perform any
computation or algorithms. It is usually stored in a simple text file and is processed by
special software that is capable of interpreting XML.
Form Navigation:
<p id="demo"></p>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "books.xml", true);
xhttp.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
var x = get_firstChild(xmlDoc.getElementsByTagName("book")[0]);
document.getElementById("demo").innerHTML = x.nodeName;
}
An XML document is a basic unit of XML information composed of elements and other
markup in an orderly package. An XML document can contains wide variety of data. For
example, database of numbers, numbers representing molecular structure or a mathematical
equation.
XML Document Example
A simple document is shown in the following example −
<?xml version = "1.0"?>
<contact-info>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</contact-info>
The following image depicts the parts of XML document.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
What You Should Already Know
Before you continue you should have a basic understanding of the following:
• HTML
• XML
If you want to study these subjects first, find the tutorials on our Home page.
XSLT References
XSLT Elements
Description of all the XSLT elements from the W3C Recommendation, and information
about browser support.
XSLT, XPath, and XQuery Functions
XSLT 2.0, XPath 2.0, and XQuery 1.0, share the same functions library. There are over 100
built-in functions. There are functions for string values, numeric values, date and time
comparison, node and QName manipulation, sequence manipulation, and more.
Web Services:
Web services are web application components.
Web services can be published, found, and used on the Web.
This tutorial introduces WSDL, SOAP, RDF, and RSS.
WSDL
• WSDL stands for Web Services Description Language
• WSDL is an XML-based language for describing Web services.
• WSDL is a W3C recommendation
SOAP
• SOAP stands for Simple Object Access Protocol
• SOAP is an XML based protocol for accessing Web Services.
• SOAP is based on XML
• SOAP is a W3C recommendation
RDF
• RDF stands for Resource Description Framework
• RDF is a framework for describing resources on the web
• RDF is written in XML
• RDF is a W3C Recommendation
RSS
• RSS stands for Really Simple Syndication
• RSS allows you to syndicate your site content
• RSS defines an easy way to share and view headlines and content
• RSS files can be automatically updated
• RSS allows personalized views for different sites
• RSS is written in XML
Imports System
Imports System.Web.Services
end class
This document is saved as an .asmx file. This is the ASP.NET file extension for XML Web
Services.
Example Explained
Note: To run this example, you will need a .NET server.
The first line in the example states that this is a Web Service, written in VBScript, and has the
class name "TempConvert":
<%@ WebService Language="VBScript" Class="TempConvert" %>
The next lines import the namespace "System.Web.Services" from the .NET framework:
Imports System
Imports System.Web.Services
The next line defines that the "TempConvert" class is a WebService class type:
Public Class TempConvert :Inherits WebService
The next steps are basic VB programming. This application has two functions. One to convert
from Fahrenheit to Celsius, and one to convert from Celsius to Fahrenheit.
The only difference from a normal application is that this function is defined as a
"WebMethod()".
Use "WebMethod()" to convert the functions in your application into web services:
<WebMethod()> Public Function FahrenheitToCelsius(ByVal Fahrenheit As String) As
String
dim fahr
fahr=trim(replace(Fahrenheit,",","."))
if fahr="" or IsNumeric(fahr)=false then return "Error"
return ((((fahr) - 32) / 9) * 5)
end function
How To Do It
Here is the code to add the Web Service to a web page:
<form action='tempconvert.asmx/FahrenheitToCelsius'
method="post" target="_blank">
<table>
<tr>
<td>Fahrenheit to Celsius:</td>
<td>
<input class="frmInput" type="text" size="30" name="Fahrenheit">
</td>
</tr>
<tr>
<td></td>
<td align="right">
<input type="submit" value="Submit" class="button">
</td>
</tr>
</table>
</form>
<form action='tempconvert.asmx/CelsiusToFahrenheit'
method="post" target="_blank">
<table>
<tr>
<td>Celsius to Fahrenheit:</td>
<td>
<input class="frmInput" type="text" size="30" name="Celsius">
</td>
</tr>
<tr>
<td></td>
<td align="right">
<input type="submit" value="Submit" class="button">
</td>
</tr>
</table>
</form>
UDDI:
UDDI is an XML-based standard for describing, publishing, and finding web services.
• UDDI stands for Universal Description, Discovery, and Integration.
• UDDI is a specification for a distributed registry of web services.
• UDDI is a platform-independent, open framework.
• UDDI can communicate via SOAP, CORBA, Java RMI Protocol.
• UDDI uses Web Service Definition Language(WSDL) to describe interfaces to web
services.
• UDDI is seen with SOAP and WSDL as one of the three foundation standards of web
services.
• UDDI is an open industry initiative, enabling businesses to discover each other and
define how they interact over the Internet.
UDDI has two sections −
• A registry of all web service's metadata, including a pointer to the WSDL description
of a service.
• A set of WSDL port type definitions for manipulating and searching that registry.
History of UDDI
• UDDI 1.0 was originally announced by Microsoft, IBM, and Ariba in September
2000.
• Since the initial announcement, the UDDI initiative has grown to include more than
300 companies including Dell, Fujitsu, HP, Hitachi, IBM, Intel, Microsoft, Oracle,
SAP, and Sun.
• In May 2001, Microsoft and IBM launched the first UDDI operator sites and turned
the UDDI registry live.
• In June 2001, UDDI announced Version 2.0.
• As the time of writing this tutorial, Microsoft and IBM sites had implemented the 1.0
specification and were planning 2.0 support in the near future.
• Currently UDDI is sponsored by OASIS.
Partner Interface Processes
Partner Interface Processes (PIPs) are XML based interfaces that enable two trading partners
to exchange data. Dozens of PIPs already exist. Some of them are listed here −
• PIP2A2 − Enables a partner to query another for product information.
• PIP3A2 − Enables a partner to query the price and availability of specific products.
• PIP3A4 − Enables a partner to submit an electronic purchase order and receive
acknowledgment of the order.
• PIP3A3 − Enables a partner to transfer the contents of an electronic shopping cart.
• PIP3B4 − Enables a partner to query the status of a specific shipment.
Private UDDI Registries
As an alternative to using the public federated network of UDDI registries available on the
Internet, companies or industry groups may choose to implement their own private UDDI
registries.
These exclusive services are designed for the sole purpose of allowing members of the
company or of the industry group to share and advertise services amongst themselves.
Regardless of whether the UDDI registry is a part of the global federated network or a
privately owned and operated registry, the one thing that ties them all together is a common
web services API for publishing and locating businesses and services advertised within the
UDDI registry.
WSDL:
WSDL stands for Web Services Description Language. It is the standard format for
describing a web service. WSDL was developed jointly by Microsoft and IBM.
Features of WSDL
• WSDL is an XML-based protocol for information exchange in decentralized and
distributed environments.
• WSDL definitions describe how to access a web service and what operations it will
perform.
• WSDL is a language for describing how to interface with XML-based services.
• WSDL is an integral part of Universal Description, Discovery, and Integration
(UDDI), an XML-based worldwide business registry.
• WSDL is the language that UDDI uses.
• WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'.
WSDL Usage
WSDL is often used in combination with SOAP and XML Schema to provide web services
over the Internet. A client program connecting to a web service can read the WSDL to
determine what functions are available on the server. Any special datatypes used are
embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to
actually call one of the functions listed in the WSDL.
History of WSDL
WSDL 1.1 was submitted as a W3C Note by Ariba, IBM, and Microsoft for describing
services for the W3C XML Activity on XML Protocols in March 2001.
WSDL 1.1 has not been endorsed by the World Wide Web Consortium (W3C), however it
has just released a draft for version 2.0 that will be a recommendation (an official standard),
and thus endorsed by the W3C.
Different books and different organizations provide different definitions to Web Services.
Some of them are listed here.
• A web service is any piece of software that makes itself available over the internet
and uses a standardized XML messaging system. XML is used to encode all
communications to a web service. For example, a client invokes a web service by
sending an XML message, then waits for a corresponding XML response. As all
communication is in XML, web services are not tied to any one operating system or
programming language—Java can talk with Perl; Windows applications can talk
with Unix applications.
• Web services are self-contained, modular, distributed, dynamic applications that can
be described, published, located, or invoked over the network to create products,
processes, and supply chains. These applications can be local, distributed, or web-
based. Web services are built on top of open standards such as TCP/IP, HTTP, Java,
HTML, and XML.
• Web services are XML-based information exchange systems that use the Internet for
direct application-to-application interaction. These systems can include programs,
objects, messages, or documents.
• A web service is a collection of open protocols and standards used for exchanging
data between applications or systems. Software applications written in various
programming languages and running on various platforms can use web services to
exchange data over computer networks like the Internet in a manner similar to inter-
process communication on a single computer. This interoperability (e.g., between
Java and Python, or Windows and Linux applications) is due to the use of open
standards.
To summarize, a complete web service is, therefore, any service that −
• Is available over the Internet or private (intranet) networks
• Uses a standardized XML messaging system
• Is not tied to any one operating system or programming language
• Is self-describing via a common XML grammar
• Is discoverable via a simple find mechanism
Components of Web Services
The basic web services platform is XML + HTTP. All the standard web services work using
the following components −
• SOAP (Simple Object Access Protocol)
• UDDI (Universal Description, Discovery and Integration)
• WSDL (Web Services Description Language)
All these components have been discussed in the Web Services Architecture chapter.
How Does a Web Service Work?
A web service enables communication among various applications by using open standards
such as HTML, XML, WSDL, and SOAP. A web service takes the help of −
• XML to tag the data
• SOAP to transfer a message
• WSDL to describe the availability of service.
You can build a Java-based web service on Solaris that is accessible from your Visual Basic
program that runs on Windows.
You can also use C# to build new web services on Windows that can be invoked from your
web application that is based on JavaServer Pages (JSP) and runs on Linux.
Example
Consider a simple account-management and order processing system. The accounting
personnel use a client application built with Visual Basic or JSP to create new accounts and
enter new customer orders.
The processing logic for this system is written in Java and resides on a Solaris machine,
which also interacts with a database to store information.
The steps to perform this operation are as follows −
• The client program bundles the account registration information into a SOAP
message.
• This SOAP message is sent to the web service as the body of an HTTP POST request.
• The web service unpacks the SOAP request and converts it into a command that the
application can understand.
• The application processes the information as required and responds with a new
unique account number for that customer.
• Next, the web service packages the response into another SOAP message, which it
sends back to the client program in response to its HTTP request.
• The client program unpacks the SOAP message to obtain the results of the account
registration process.