6 - Web Services Flashcards
Web Services
Web services are self-contained, modular, distributed, dynamic applications that can be described, published,
located, and invoked over the network to create products, processes, and supply chains. These applications can be local, distributed, or Web-based
Benefits of using standardized Web technologies (XML, HTTP)
- Interoperability and extensibility allow connectivity between software applications
- Less dependency on networks, operating systems, and platforms
- Ideal for connecting software applications
- Coupling of Web services
Hypertext Transfer Protocol (HTTP)
HTTP is a stateless application level protocol for distributed, collaborative, hypertext information systems
HTTP Protocols are used for:
- The communication and interaction with Web Services
- For text based request responses
- Data exchange over network based on rules
Structure of HTTP Message (parts) (3)
- The start line shows the requested method or response status
- The optional message header consists out of name value pairs that describe additional arguments needed for data transmission
- The optional message body carries the data payload
-> text-based request-response protocol for distributed information systems
HTTPS
HTTP messages, that are encrypted for security
- Transport Layer Security (TLS) is used for encryption
HTTP - Process
- Client retrieves website with the address http://example.com/info from a Web server
- A HTTP request message is sent over a TCP/IP connection to the Web server associated with the domain example.com
- With info, the identified resource is accessed
- The Web site data is returned via a HTTP response message
HTTP - Request Message
Request Methods:
- GET requests the resource’s representation
- HEAD is identical to GET, but only returns the response message’s header
- PUT stores payload data in a request body as a resource, specified by the given URI
HTTP - Response Message
The starting line of an HTTP Response contains:
- The protocol version
- A status code
- A message indicating corresponding HTTP request status
HTTP status codes
- Status code 200 with the message OK is the standard response if an operation was successful
- Status code 301 with the message Moved Permanently states that the resource asked for, was moved to another URI
- Status code 403 with the message Forbidden states that the client has no access rights
HTTP - Caching
- One major advantage of HTTP is caching
- Caching allows to satisfy large amounts of requests, that
enables scalable Web services
Functionality:
- Previous HTTP responses are stored
- The stored responses answer future HTTP requests
- This leads to a faster response
- Caching works for common requests
- It only works with methods, which do not modify the resource, like GET
XML
Extensible Markup Language, commonly abbreviated XML, describes a class of data objects called XML documents and partially describes the behavior of the computer programs which process them.
XML Basic Document Structure
XML document forms a hierarchical tree structure consisting of XML nodes:
- XML Element
- XML Attribute
- XML Comment
XML Element
Markup or content enclosed by a starting and ending tag (Only node that can have childnodes. They start with < and end with >)
Start- and Endtag: . . .
XML Attribute
Optional key-value pairs embedded in element tags
XML Comment
Text ignored by software processing XML documents
Plain text file
Binary data must be additionally encoded.
XML Document is well-formed if: (5)
- It contains only legal Unicode text
- It has a single root element
- Each tag is opened and closed
- Tags are correctly nested
- Elements have no duplicate attributes
XML Tree: Parent, Child, and Sibling
- Elements can have content, text or child elements
- Example: The element has content. This content consists of six child elements
- Vice versa, the element has the parent
- Two child elements, with the same parent element, are siblings
XML Schema Definition (XSD)
XSD schema aims at defining and describing a class of XML documents via schema components to constrain and document the meaning, usage, and relationships of their constituent parts: datatypes, elements, as well as their content, attributes and values
Function of XSD
- XML parse only accepts documents that comply with XML syntax rules
- Besides correct syntax, there are additional rules documents have to fulfill
- The XML schema definition specifies those additional rules
Web Service Architecture - Example of a Service
Credit Card company’s service that checks a credit card number’s validity
-> repeatable business activity
The outcome is the assessment of the credit card
-> specific outcome, self contained
There is no information about which databases are accessed
-> black box
Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA) represents a set of principles and methodologies for designing and developing software in the form of interoperable
services. These services are well defined business functions that are built as software components i.e., discrete pieces of code and/or data structures that can
be reused for different.
Service Provider
Hosts services, provides interfaces, allows service requester to access the service