By Vijayapriya P Department of CS & IT Nadar saraswathi college of arts & science Publishing and consuming web services
Topic includes Publishing and consuming web services  Define web services  SOAP web services  Characteristic of web services  Advantages of SOAP  SOAP Message  REST based xml services  REST web services  HTTP method of rest web services  Rest based JSON web services  JSON schema
 Web publishing is the process of publishing  The process includes building and uploading websites, updating the associated WebPages, and posting content to these WebPages online.  Web publishing comprises of personal, business, and community websites in addition to e-books and blogs. Publishing and consuming Web services
 A Web service is a method of communication between two electronic devices over a network.  It is a software function provided at a network address over the Web with the service always-on as in the concept of utility computing. Many organizations use multiple software systems for management. web services Definition :
What is web services?  Services are available in the web.  Communication between the two system over network.  Software system designed to support interoperable Machine- machine interaction over the network {w3c definition}. Real –time Example:  Face book  Google  Twitter  e-commerce sites
 SOAP provides an envelope to send a web services messages over the Internet, using the HTTP protocol.  The messages are generally in XML format. In simple words, SOAP is a technique to send an XML request over the Internet using HTTP protocol (hitting a URL), and in return getting an XML response. SOAP Web services Simple Object Access Protocol(SOAP)
 WS Security: SOAP defines its own security known as WS Security .  Language and Platform independent: SOAP web services can be written in any programming language and executed in any platform.. Advantages of Soap Web Services Advantages : Dis Advantages :  Slow: SOAP uses XML format that must be parsed to be read. It defines many standards that must be followed while developing the SOAP applications. So it is slow and consumes more bandwidth and resource.  WSDL dependent: SOAP uses WSDL and doesn't have any other mechanism to discover the service.
 It is an open standard protocol used in the web service to communicate via internet.  It is used to broadcast a message over the network.  It is used to call remote procedures and exchange documents.  It can be used on any platform and can support multi- languages. So, it is a platform and language independent.  It uses the XML format to send messages over the HTTP protocol. The structure of a SOAP message consists of an envelope, header, and body element. Characteristic of SOAP
 The SOAP message contains the following information in the XML format, as given below.  It contains information about the message structure and instructions during processing on the network.  The SOAP contains an envelope that represents the starting and end of the message in the XML format.  In the message, the header is an optional element that contains application-specific information such as authentication, authorization, and payment etc. SOAP message
 A fault element is an optional element that shows an error message during the processing of the information.  An Envelope element that identifies the XML document as a SOAP message.  A Header element that contains header information. A Body element that contains call and response Information. Cont.,
 The SOAP building block describes what XML data is sent to the web service and client application.  The following diagram represents the SOAP building block. SOAP Building Block
 SOAP Header: It is an optional element in which the header contains the credentials information such as authorization, authentication, etc.  Is used during the processing of a SOAP message. Cont.,  SOAP Envelope: Envelope is used to define the start and end of the SOAP message.  It contains the details of the SOAP message. It is an important element of the XML documents.
 SOAP Fault: The SOAP Fault element is an optional element used to display an error message encountered during the transmission of a SOAP message.  It holds the status of SOAP messages and errors.  SOAP Body: It is an important element of the SOAP message that contains request and response information in the XML format.  It defines the actual content of the message to be sent between the client and the web server.
Sub Fault Element Description <faultcode> It is used to identify the fault code in the SOAP message. <faultstring> It is used to provide the human-readable description of the error. <faultactor> It is an optional element in the SOAP Fault that indicate the fault occurred during processing if the message. <detail> It is used to hold the application-specific status error of the Body element
 XML Web services are the fundamental building blocks in the move to distributed computing on the Internet.  Open standards and the focus on communication and collaboration among people and applications have created an environment where XML Web services are becoming the platform for application integration REST based XML Web services REpresentational State Transfer (REST)
 Applications are constructed using multiple XML Web services from various sources that work together regardless of where they reside or how they were implemented.  There are probably as many definitions of XML Web Service as there are companies building them, but almost all definitions have these things in common: Cont.,  XML Web Services expose useful functionality to Web users through a standard Web protocol.  In most cases, the protocol used is SOAP
 XML Web services provide a way to describe their interfaces in enough detail to allow a user to build a client application to talk to them.  This description is usually provided in an XML document called a Web Services Description Language (WSDL) document.  XML Web services are registered so that potential users can find them easily.  This is done with Universal Discovery Description and Integration (UDDI).
Service provider Service consumer
 It is an architectural style that provides standards between computer systems on a web service. It is a set of constraints used to create a lightweight, scalable, and maintainable web service that facilitates easy communication with each other.  All web services are based on the REST; hence it is called a RESTful service. REST Web services
 The purpose of developing a RESTful web service is to make the web service more effective. The Roy Fielding develops it in 2000, who also developed the HTTP protocol.  It does not depend on a specific protocol to use, but it's used HTTP/HTTPS.
GET: It is used to fetch information from the resource server. POST: It is used to create or insert new information on the resource server. DELETE: It is used to remove the records or information from the resource server. HTTP Method of REST web service
 Client-Server  Stateless Server  Cacheable  Uniform Interface  Layered System Constraint and the Principles of REST Client-Server Model:  Client: Client machines or users send a special request to the web server and wait for the web server's response.  Server: Server is the collection of web resources that provides different services to multiples clients. It receives multiples requests from the client machines and respons to that request to the client.
 Stateless Server: Each request generated from the client- side to the server should contain all the necessary information easily understood by the server.  Cache Response: Any response received from the web server must verify whether the response is cacheable or not.  A cache helps both the clients and the servers response faster to not generate traffic to the web server. Cont.,  Layered system : It is used to accommodate extra layers like proxy servers, firewalls, gateways, and caching system.
 Uniform Interface: It is the technique that represents how the REST web service is worked with HTTP protocol. Resource Identifier - URL/URI  Resource Representation and Manipulation - It defines which the URL identifies data resources. And that data can be manipulated directly from the client URL requested to the Server.  It helps to manage communication between client and server.  Code on Demand: It is an optional code on-demand constraints that allow the client to request and execute the server's code.
 A Request-Response JSON web service can be used only in provider mode (where CICS acts as the server).  This scenario is different to that of SOAP web services.  The concept of a RESTful JSON web service is described more completely in Concepts of RESTful JSON web services. REST based JSON Web services For example, an application might use this facility in order to generate JSON data to send to a remote JSON web service. To do this, it must contact the remote JSON web service using the CICS WEB API. JavaScript Object Notation(JSON)
JSON – What is it?  “JSON (JavaScript Object Notation) is a lightweight data-interchange format.  This data interchange can happen between two computer applications at different geographical locations or running within the same machine.  It is easy to for humans to read and write. It is easy for Machines to parse and generate”- JSON.org Importantly : JSON is a subset of JavaScript
 JSON format is used for serializing and transmitting structured data over network connection.  It is primarily used to transmit data between a server and web applications.  Web services and APIs use JSON format to provide public data. It can be used with modern programming languages. Cont.,
JSON schema  One disadvantage of JSON compared to SOAP is the difficulty in documenting the structure of a JSON interface. SOAP web services have the advantage of WSDL documents, together with XML schemas.  A WSDL document may not be easy to understand, but there are many tools available to work with WSDL documents.  The nearest equivalent for JSON is the JSON Schema specification available at http://json-schema.org/.
 At the time of writing this is a draft specification which is making its way through the IETF standardization process.  You can use the JSON schema to understand the valid syntax and content model for a JSON web service that has been implemented in CICS. T Cont.,  The JSON schema specification doesn't have the same tooling ecosystem as the XML schema specification, but a new generation of JSON tools might emerge to use this data format.
Request-Response  The Request-Response JSON pattern is very similar to that of SOAP based web services in CICS. The web service is implemented using a PROGRAM in CICS.  The PROGRAM has input and output data formats, described using language structures (such as COBOL copybooks), and CICS is responsible for transforming incoming JSON messages into application data, and linking to the application.  The application returns output data back to CICS, and CICS transforms this into JSON data to return to the client.
 It is used while writing JavaScript based applications that includes browser extensions and websites.  JSON format is used for serializing and transmitting structured data over network connection.  It is primarily used to transmit data between a server and web applications.  Web services and APIs use JSON format to provide public data.  It can be used with modern programming languages. Uses of JSON
Soap request message Soap response message SOAP and REST web services
Web Programming

Web Programming

  • 1.
    By Vijayapriya P Department ofCS & IT Nadar saraswathi college of arts & science Publishing and consuming web services
  • 2.
    Topic includes Publishing andconsuming web services  Define web services  SOAP web services  Characteristic of web services  Advantages of SOAP  SOAP Message  REST based xml services  REST web services  HTTP method of rest web services  Rest based JSON web services  JSON schema
  • 3.
     Web publishingis the process of publishing  The process includes building and uploading websites, updating the associated WebPages, and posting content to these WebPages online.  Web publishing comprises of personal, business, and community websites in addition to e-books and blogs. Publishing and consuming Web services
  • 4.
     A Webservice is a method of communication between two electronic devices over a network.  It is a software function provided at a network address over the Web with the service always-on as in the concept of utility computing. Many organizations use multiple software systems for management. web services Definition :
  • 5.
    What is webservices?  Services are available in the web.  Communication between the two system over network.  Software system designed to support interoperable Machine- machine interaction over the network {w3c definition}. Real –time Example:  Face book  Google  Twitter  e-commerce sites
  • 7.
     SOAP providesan envelope to send a web services messages over the Internet, using the HTTP protocol.  The messages are generally in XML format. In simple words, SOAP is a technique to send an XML request over the Internet using HTTP protocol (hitting a URL), and in return getting an XML response. SOAP Web services Simple Object Access Protocol(SOAP)
  • 8.
     WS Security:SOAP defines its own security known as WS Security .  Language and Platform independent: SOAP web services can be written in any programming language and executed in any platform.. Advantages of Soap Web Services Advantages : Dis Advantages :  Slow: SOAP uses XML format that must be parsed to be read. It defines many standards that must be followed while developing the SOAP applications. So it is slow and consumes more bandwidth and resource.  WSDL dependent: SOAP uses WSDL and doesn't have any other mechanism to discover the service.
  • 9.
     It isan open standard protocol used in the web service to communicate via internet.  It is used to broadcast a message over the network.  It is used to call remote procedures and exchange documents.  It can be used on any platform and can support multi- languages. So, it is a platform and language independent.  It uses the XML format to send messages over the HTTP protocol. The structure of a SOAP message consists of an envelope, header, and body element. Characteristic of SOAP
  • 10.
     The SOAPmessage contains the following information in the XML format, as given below.  It contains information about the message structure and instructions during processing on the network.  The SOAP contains an envelope that represents the starting and end of the message in the XML format.  In the message, the header is an optional element that contains application-specific information such as authentication, authorization, and payment etc. SOAP message
  • 11.
     A faultelement is an optional element that shows an error message during the processing of the information.  An Envelope element that identifies the XML document as a SOAP message.  A Header element that contains header information. A Body element that contains call and response Information. Cont.,
  • 12.
     The SOAPbuilding block describes what XML data is sent to the web service and client application.  The following diagram represents the SOAP building block. SOAP Building Block
  • 13.
     SOAP Header:It is an optional element in which the header contains the credentials information such as authorization, authentication, etc.  Is used during the processing of a SOAP message. Cont.,  SOAP Envelope: Envelope is used to define the start and end of the SOAP message.  It contains the details of the SOAP message. It is an important element of the XML documents.
  • 14.
     SOAP Fault:The SOAP Fault element is an optional element used to display an error message encountered during the transmission of a SOAP message.  It holds the status of SOAP messages and errors.  SOAP Body: It is an important element of the SOAP message that contains request and response information in the XML format.  It defines the actual content of the message to be sent between the client and the web server.
  • 15.
    Sub Fault ElementDescription <faultcode> It is used to identify the fault code in the SOAP message. <faultstring> It is used to provide the human-readable description of the error. <faultactor> It is an optional element in the SOAP Fault that indicate the fault occurred during processing if the message. <detail> It is used to hold the application-specific status error of the Body element
  • 17.
     XML Webservices are the fundamental building blocks in the move to distributed computing on the Internet.  Open standards and the focus on communication and collaboration among people and applications have created an environment where XML Web services are becoming the platform for application integration REST based XML Web services REpresentational State Transfer (REST)
  • 18.
     Applications areconstructed using multiple XML Web services from various sources that work together regardless of where they reside or how they were implemented.  There are probably as many definitions of XML Web Service as there are companies building them, but almost all definitions have these things in common: Cont.,  XML Web Services expose useful functionality to Web users through a standard Web protocol.  In most cases, the protocol used is SOAP
  • 19.
     XML Webservices provide a way to describe their interfaces in enough detail to allow a user to build a client application to talk to them.  This description is usually provided in an XML document called a Web Services Description Language (WSDL) document.  XML Web services are registered so that potential users can find them easily.  This is done with Universal Discovery Description and Integration (UDDI).
  • 20.
  • 21.
     It isan architectural style that provides standards between computer systems on a web service. It is a set of constraints used to create a lightweight, scalable, and maintainable web service that facilitates easy communication with each other.  All web services are based on the REST; hence it is called a RESTful service. REST Web services
  • 22.
     The purposeof developing a RESTful web service is to make the web service more effective. The Roy Fielding develops it in 2000, who also developed the HTTP protocol.  It does not depend on a specific protocol to use, but it's used HTTP/HTTPS.
  • 24.
    GET: It is usedto fetch information from the resource server. POST: It is used to create or insert new information on the resource server. DELETE: It is used to remove the records or information from the resource server. HTTP Method of REST web service
  • 25.
     Client-Server  StatelessServer  Cacheable  Uniform Interface  Layered System Constraint and the Principles of REST Client-Server Model:  Client: Client machines or users send a special request to the web server and wait for the web server's response.  Server: Server is the collection of web resources that provides different services to multiples clients. It receives multiples requests from the client machines and respons to that request to the client.
  • 26.
     Stateless Server:Each request generated from the client- side to the server should contain all the necessary information easily understood by the server.  Cache Response: Any response received from the web server must verify whether the response is cacheable or not.  A cache helps both the clients and the servers response faster to not generate traffic to the web server. Cont.,  Layered system : It is used to accommodate extra layers like proxy servers, firewalls, gateways, and caching system.
  • 27.
     Uniform Interface:It is the technique that represents how the REST web service is worked with HTTP protocol. Resource Identifier - URL/URI  Resource Representation and Manipulation - It defines which the URL identifies data resources. And that data can be manipulated directly from the client URL requested to the Server.  It helps to manage communication between client and server.  Code on Demand: It is an optional code on-demand constraints that allow the client to request and execute the server's code.
  • 28.
     A Request-ResponseJSON web service can be used only in provider mode (where CICS acts as the server).  This scenario is different to that of SOAP web services.  The concept of a RESTful JSON web service is described more completely in Concepts of RESTful JSON web services. REST based JSON Web services For example, an application might use this facility in order to generate JSON data to send to a remote JSON web service. To do this, it must contact the remote JSON web service using the CICS WEB API. JavaScript Object Notation(JSON)
  • 29.
    JSON – Whatis it?  “JSON (JavaScript Object Notation) is a lightweight data-interchange format.  This data interchange can happen between two computer applications at different geographical locations or running within the same machine.  It is easy to for humans to read and write. It is easy for Machines to parse and generate”- JSON.org Importantly : JSON is a subset of JavaScript
  • 30.
     JSON formatis used for serializing and transmitting structured data over network connection.  It is primarily used to transmit data between a server and web applications.  Web services and APIs use JSON format to provide public data. It can be used with modern programming languages. Cont.,
  • 31.
    JSON schema  Onedisadvantage of JSON compared to SOAP is the difficulty in documenting the structure of a JSON interface. SOAP web services have the advantage of WSDL documents, together with XML schemas.  A WSDL document may not be easy to understand, but there are many tools available to work with WSDL documents.  The nearest equivalent for JSON is the JSON Schema specification available at http://json-schema.org/.
  • 32.
     At thetime of writing this is a draft specification which is making its way through the IETF standardization process.  You can use the JSON schema to understand the valid syntax and content model for a JSON web service that has been implemented in CICS. T Cont.,  The JSON schema specification doesn't have the same tooling ecosystem as the XML schema specification, but a new generation of JSON tools might emerge to use this data format.
  • 33.
    Request-Response  The Request-ResponseJSON pattern is very similar to that of SOAP based web services in CICS. The web service is implemented using a PROGRAM in CICS.  The PROGRAM has input and output data formats, described using language structures (such as COBOL copybooks), and CICS is responsible for transforming incoming JSON messages into application data, and linking to the application.  The application returns output data back to CICS, and CICS transforms this into JSON data to return to the client.
  • 34.
     It isused while writing JavaScript based applications that includes browser extensions and websites.  JSON format is used for serializing and transmitting structured data over network connection.  It is primarily used to transmit data between a server and web applications.  Web services and APIs use JSON format to provide public data.  It can be used with modern programming languages. Uses of JSON
  • 35.