Web Service
• A Web Service can be defined by following ways:
– is a client server application or application component
for communication.
– method of communication between two devices over
network.
– is a software system for interoperable machine to
machine communication.
– is a collection of standards or protocols for exchanging
information between two devices or application.
• As shown in the figure, java, .net or PHP applications can
communicate with other applications through web service
over the network.
• For example, a Java application can interact with Java, .Net
and PHP applications. So web service is a language
independent way of communication.
Types of Web Services
• There are mainly two types of web services.
– SOAP web services.
– RESTful web services.
SOAP
• SOAP is an acronym for Simple Object Access
Protocol. It is an XML-based messaging
protocol for exchanging information among
computers.
• SOAP is an application of the XML
specification.
SOAP - Message Structure
• A SOAP message is an ordinary XML document
containing the following elements −
– Envelope: Defines the start and the end of the
message. It is a mandatory element.
– Header: Contains any optional attributes of the
message used in processing the message, either at an
intermediary point or at the ultimate end-point. It is
an optional element.
– Body: Contains the XML data comprising the message
being sent. It is a mandatory element.
– Fault: An optional Fault element that provides
information about errors that occur while processing
the message.
• All these elements are declared in the default
namespace for the SOAP envelope
− http://www.w3.org/2001/12/soap-
envelope
• The default namespace for SOAP encoding
and data types is
− http://www.w3.org/2001/12/soap-encoding
SOAP - Envelope
• The SOAP envelope indicates the start and the
end of the message so that the receiver knows
when an entire message has been received.
• The SOAP envelope solves the problem of
knowing when you are done receiving a
message and are ready to process it.
• The SOAP envelope is, therefore, basically a
packaging mechanism.
• Every SOAP message has a root Envelope
element.
• Envelope is a mandatory part of SOAP message.
• Every Envelope element must contain exactly one
Body element.
• If an Envelope contains a Header element, it must
contain no more than one, and it must appear as
the first child of the Envelope, before the Body.
• The envelope changes when SOAP versions
change.
• The SOAP envelope is specified using
the ENV namespace prefix and the Envelope
element.
• The optional SOAP encoding is also specified
using a namespace name and the
optional encodingStyle element, which could
also point to an encoding style other than the
SOAP one.
• A v1.1-compliant SOAP processor generates a
fault upon receiving a message containing the
v1.2 envelope namespace.
• A v1.2-compliant SOAP processor generates
a VersionMismatch fault if it receives a
message that does not include the v1.2
envelope namespace.
Web services

Web services

  • 2.
    Web Service • AWeb Service can be defined by following ways: – is a client server application or application component for communication. – method of communication between two devices over network. – is a software system for interoperable machine to machine communication. – is a collection of standards or protocols for exchanging information between two devices or application.
  • 3.
    • As shownin the figure, java, .net or PHP applications can communicate with other applications through web service over the network. • For example, a Java application can interact with Java, .Net and PHP applications. So web service is a language independent way of communication.
  • 4.
    Types of WebServices • There are mainly two types of web services. – SOAP web services. – RESTful web services.
  • 5.
    SOAP • SOAP isan acronym for Simple Object Access Protocol. It is an XML-based messaging protocol for exchanging information among computers. • SOAP is an application of the XML specification.
  • 6.
    SOAP - MessageStructure • A SOAP message is an ordinary XML document containing the following elements − – Envelope: Defines the start and the end of the message. It is a mandatory element. – Header: Contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end-point. It is an optional element. – Body: Contains the XML data comprising the message being sent. It is a mandatory element. – Fault: An optional Fault element that provides information about errors that occur while processing the message.
  • 7.
    • All theseelements are declared in the default namespace for the SOAP envelope − http://www.w3.org/2001/12/soap- envelope • The default namespace for SOAP encoding and data types is − http://www.w3.org/2001/12/soap-encoding
  • 8.
    SOAP - Envelope •The SOAP envelope indicates the start and the end of the message so that the receiver knows when an entire message has been received. • The SOAP envelope solves the problem of knowing when you are done receiving a message and are ready to process it. • The SOAP envelope is, therefore, basically a packaging mechanism.
  • 9.
    • Every SOAPmessage has a root Envelope element. • Envelope is a mandatory part of SOAP message. • Every Envelope element must contain exactly one Body element. • If an Envelope contains a Header element, it must contain no more than one, and it must appear as the first child of the Envelope, before the Body. • The envelope changes when SOAP versions change. • The SOAP envelope is specified using the ENV namespace prefix and the Envelope element.
  • 10.
    • The optionalSOAP encoding is also specified using a namespace name and the optional encodingStyle element, which could also point to an encoding style other than the SOAP one. • A v1.1-compliant SOAP processor generates a fault upon receiving a message containing the v1.2 envelope namespace. • A v1.2-compliant SOAP processor generates a VersionMismatch fault if it receives a message that does not include the v1.2 envelope namespace.