XML Schema
An XML Schema defines the list of elements and attributes that can be used in XML
document.It aso specifies the order in which these elements appear in XML
documents, and their data types.
Advantages of XML Schemas Created Using XSD
 XSD Provides Control over the type of data that can be assigned to elements and
attributes.
 XSD enables you to create your own datatypes.
 XSD enables you to specify restriction on data.
 Syntax for defining an XSD is the same as the syntax used for XML documents.
 XML Schema is self documenting
Data types
Data Types in XML Schemas
 Primitive
 Derived
 Atomic
 List
 Union
Primitive Data Type
Primitive Data Type Description
string Represents collection of characters
decimal Represents decimal numbers.
float
Represents single-precision 32 bit
floating point
boolean Represents boolean value
Primitive Data Types
Primitive Data Type
Primitive Data Type Description
string
Represents collection of
characters
decimal Represents decimal numbers.
float
Represents single-precision 32
bit floating point
boolean Represents boolean value
timeDuration
Represents certain duration of
time.
recurringDuration
Represents a time duration that
recurs after a specific interval
Derived data Types
Derived Data Type Base Data type Description
integer decimal
Represents a sequence of
decimal digit with
optional leading sign (+
or -)
long Integer
Represents a value with
in range -
99223372036854775808
to
99223372036854775808
nonNegativeInteger integer
Represents an integer
that is greater than or
equal to zero
positiveInteger nonNegativeInteger
Represents an integer
greater than zero
int Long
Represents an integer
with the range -
2147483648 to
2147483648
time recurringDuration
Represents an instance of
time that recurs everyday
Atomic and List data Types
Atomic data types
 Atomic data types that cannot be broken into smaller units e.g;string
List data types
List data types are derived data types This contains set of values of atomic data types.
<simpleType name='listOfString'>
<list itemType='string'/>
</simpleType>
<someElement xsi:type='listOfString'>
this is not list item 1
this is not list item 2
this is not list item 3
</someElement>
Union data types
Union Data Types
 Union data types are derived from the list and atomic data types.
Elements in XML Schema
There are two types of elements that can be defined in schema Simple and complex
Element
Simple Element
A simple type element doesnot contain any child elemnets or attributes.It contaons
only values,such as numbers,strings and dates.
<xsd:element name=”element-name” type=”data-type” minOccurs=”non-
Negativeineteger” maxOccurs=”nonNegativeinteger|unbounded”>
Complex Element
A complex elements contain other elements,attributes and mixed content.
<xsd:complexType name=”data type name” >
Contenet model declaration
<xsd:complexType>
Elements in XML Schema
<xsd:complexType name=”prdt”>
<xsd:sequence>
<xsd:elemet name=”PRODUCTNAME” type=”xsd:string”>
<xsd:elemet name=”DESCRIPTION” type=”xsd:string”>
<xsd:sequence>
SOAP
 Soap is an XML-based protocol for exchaging information between two different
computers.
 Although SOAP can be used in a variety of messaging systems and can be delivered
via a variety of transport protocols, the initial focus of SOAP is remote procedure
calls transported via HTTP.
 SOAP is XML. That is, SOAP is an application of the XML specification.
 It relies heavily on XML standards like XML Schema and XML Namespaces for its
definition and function.
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.
Request and Response Of Soap message
Soap Message Exchanging Model
A SOAP application receiving a SOAP message MUST process that message by
performing the following actions in the order listed below:
 Step1:Identify all parts of the SOAP message intended for that application
 Step2:Verify that all mandatory parts identified in step 1 are supported by the
application for this message and process them accordingly. If this is not the case
then discard the message . The processor MAY ignore optional parts identified in
step 1 without affecting the outcome of the processing.
 Step3:If the SOAP application is not the ultimate destination of the message
then remove all parts identified in step 1 before forwarding the message.
The grammar rules are as follows:
Envelope
 The element name is "Envelope".
 The element MUST be present in a SOAP message
 The element MAY contain namespace declarations as
well as additional attributes. If present, such additional
attributes MUST be namespace-qualified. Similarly,
the element MAY contain additional sub elements. If present these elements MUST be
namespace-qualified and MUST follow the SOAP Body element.
Header
 The element name is "Header".
 The element MAY be present in a SOAP message. If present, the element MUST be
the first immediate child element of a SOAP Envelope element.
 The element MAY contain a set of header entries each being an immediate child
element of the SOAP Header element. All immediate child elements of the SOAP
Header element MUST be namespace-qualified.
Body
 The element name is "Body".
 The element MUST be present in a SOAP message and MUST be an immediate child
element of a SOAP Envelope element. It MUST directly follow the SOAP Header
element if present. Otherwise it MUST be the first immediate child element of the
SOAP Envelope element.
 The element MAY contain a set of body entries each being an immediate child
element of the SOAP Body element. Immediate child elements of the SOAP Body
element MAY be namespace-qualified. SOAP defines the SOAP Fault element, which
is used to indicate error messages

Soap win

  • 1.
    XML Schema An XMLSchema defines the list of elements and attributes that can be used in XML document.It aso specifies the order in which these elements appear in XML documents, and their data types. Advantages of XML Schemas Created Using XSD  XSD Provides Control over the type of data that can be assigned to elements and attributes.  XSD enables you to create your own datatypes.  XSD enables you to specify restriction on data.  Syntax for defining an XSD is the same as the syntax used for XML documents.  XML Schema is self documenting
  • 2.
    Data types Data Typesin XML Schemas  Primitive  Derived  Atomic  List  Union Primitive Data Type Primitive Data Type Description string Represents collection of characters decimal Represents decimal numbers. float Represents single-precision 32 bit floating point boolean Represents boolean value
  • 3.
    Primitive Data Types PrimitiveData Type Primitive Data Type Description string Represents collection of characters decimal Represents decimal numbers. float Represents single-precision 32 bit floating point boolean Represents boolean value timeDuration Represents certain duration of time. recurringDuration Represents a time duration that recurs after a specific interval
  • 4.
    Derived data Types DerivedData Type Base Data type Description integer decimal Represents a sequence of decimal digit with optional leading sign (+ or -) long Integer Represents a value with in range - 99223372036854775808 to 99223372036854775808 nonNegativeInteger integer Represents an integer that is greater than or equal to zero positiveInteger nonNegativeInteger Represents an integer greater than zero int Long Represents an integer with the range - 2147483648 to 2147483648 time recurringDuration Represents an instance of time that recurs everyday
  • 5.
    Atomic and Listdata Types Atomic data types  Atomic data types that cannot be broken into smaller units e.g;string List data types List data types are derived data types This contains set of values of atomic data types. <simpleType name='listOfString'> <list itemType='string'/> </simpleType> <someElement xsi:type='listOfString'> this is not list item 1 this is not list item 2 this is not list item 3 </someElement>
  • 6.
    Union data types UnionData Types  Union data types are derived from the list and atomic data types.
  • 7.
    Elements in XMLSchema There are two types of elements that can be defined in schema Simple and complex Element Simple Element A simple type element doesnot contain any child elemnets or attributes.It contaons only values,such as numbers,strings and dates. <xsd:element name=”element-name” type=”data-type” minOccurs=”non- Negativeineteger” maxOccurs=”nonNegativeinteger|unbounded”> Complex Element A complex elements contain other elements,attributes and mixed content. <xsd:complexType name=”data type name” > Contenet model declaration <xsd:complexType>
  • 8.
    Elements in XMLSchema <xsd:complexType name=”prdt”> <xsd:sequence> <xsd:elemet name=”PRODUCTNAME” type=”xsd:string”> <xsd:elemet name=”DESCRIPTION” type=”xsd:string”> <xsd:sequence>
  • 9.
    SOAP  Soap isan XML-based protocol for exchaging information between two different computers.  Although SOAP can be used in a variety of messaging systems and can be delivered via a variety of transport protocols, the initial focus of SOAP is remote procedure calls transported via HTTP.  SOAP is XML. That is, SOAP is an application of the XML specification.  It relies heavily on XML standards like XML Schema and XML Namespaces for its definition and function. 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.
  • 11.
    Request and ResponseOf Soap message
  • 12.
    Soap Message ExchangingModel A SOAP application receiving a SOAP message MUST process that message by performing the following actions in the order listed below:  Step1:Identify all parts of the SOAP message intended for that application  Step2:Verify that all mandatory parts identified in step 1 are supported by the application for this message and process them accordingly. If this is not the case then discard the message . The processor MAY ignore optional parts identified in step 1 without affecting the outcome of the processing.  Step3:If the SOAP application is not the ultimate destination of the message then remove all parts identified in step 1 before forwarding the message.
  • 13.
    The grammar rulesare as follows: Envelope  The element name is "Envelope".  The element MUST be present in a SOAP message  The element MAY contain namespace declarations as well as additional attributes. If present, such additional attributes MUST be namespace-qualified. Similarly, the element MAY contain additional sub elements. If present these elements MUST be namespace-qualified and MUST follow the SOAP Body element. Header  The element name is "Header".  The element MAY be present in a SOAP message. If present, the element MUST be the first immediate child element of a SOAP Envelope element.  The element MAY contain a set of header entries each being an immediate child element of the SOAP Header element. All immediate child elements of the SOAP Header element MUST be namespace-qualified.
  • 14.
    Body  The elementname is "Body".  The element MUST be present in a SOAP message and MUST be an immediate child element of a SOAP Envelope element. It MUST directly follow the SOAP Header element if present. Otherwise it MUST be the first immediate child element of the SOAP Envelope element.  The element MAY contain a set of body entries each being an immediate child element of the SOAP Body element. Immediate child elements of the SOAP Body element MAY be namespace-qualified. SOAP defines the SOAP Fault element, which is used to indicate error messages