Lesson 4: Web Services Flashcards

1
Q

What is the 3-tier architecture?

A

Presentation - Business - Persistence

Client - web server - database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a web service?

A

A web service is a software system designed to support interoperable machine-to-machine interaction over a network.
— extra details —
It has an interface described in a machine-processable format (WSDL). Other systems interact with the web service in a manner prescribed by its description using SOAP or RESTful messages, typically conveyed using HTTP with an XML or JSON serialization in conjunction with other web-related standards.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Give some benefits of a web service.

A
  • loose coupled design
  • ease of integration
  • service reuse
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What benefits do we gain with a loose coupled design in a web service?

A
  • Each service exists independently of the other services that make up the application
  • Individual pieces of the application can be modified without impacting unrelated areas.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some characteristics of the ‘ease of integration’ benefit when using a web service?

A
  • Data is isolated between applications.
  • Web services act as glue between these and enable easier communications within an across organizations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the ‘service reuse’ benefit of web services.

A
  • Take code reuse a step further
  • A specific function within the domain is only ever coded once and used over and over again by consuming applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is REST and what is it short for?

A

REpresentational State Transfer.

Rest in an architectural style.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between URI, URL and URN

A

URI is a Uniform Resource Identifier and can be a URL, URN or both.

URL is a Uniform Resource Locator and is the location where you can find the resource

URN is a Uniform Resource Name and defines an item identity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are REST resources described?

A
  • Describe resources, not applications
  • Make it short
  • Hackable up the tree
  • Meaningful
  • Predictable, human-readable
  • Nouns, not verbs
  • Permanent
  • Query arguments are only for parameters
  • Avoid extensions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a RESTful API? What does it have?

A

= web service API that adheres to the REST style

  • it has a base URI
  • it has an internet media type for the data
  • It uses standard HTTP methods
  • It uses hypertext links to reference states
  • It uses hypertext links to reference related resources
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe JSON in keywords.

A
  • Open Standard
  • Human-Readable text
  • Alternative to XML
  • Language-independent
  • Support in many programming languages
  • has the ability to define a schema for validation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the 6 REST architectural constraints?

A

1) Interface uniformity between components
2) Client-server model (separation of concerns)
3) Stateless client-server communication
4) caching
5) Layering
6) Code on demand (optional)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the “Interface uniformity between components” constraint in REST?

A

Components need to speak the same language and know what to expect in order to understand each other

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the “client-server model (separation of concerns)” constraint in REST?

A

Client and server are fully decoupled and can be developed independently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the “stateless client-server communication” constraint in REST?

A

Each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored session state on the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the “caching” constraint in REST?

A

Clients can cache responses to requests, improving scalability and performance. The fact that responses are not cacheable should be implicitly or explicitly defined.

17
Q

What is the “layering” constraint in REST?

A

A client cannot tell if it is directly connected to a server or to some intermediary. This allows for load-balancing, fail-over and data transformation.

18
Q

What is the “code-on-demand” constraint in REST?

A

Client functionality can be dynamically extended through the transfer of executable code.

19
Q

Compare REST and RPC.

A

RPC:
- many operations, few URI
- address software components
- procedure name and parameters are transferred

20
Q

Compare REST and RPC.

A

RPC:
- many operations, few URI
- address software components
- procedure name and parameters are transferred

REST:
- Few operations, many URI
- Address resources
- Resource representations are transferred

21
Q

What are advantages of REST?

A
  • Uniform interface is immutable
  • Conceptually simpler
  • Lower protocol overhead (for stateless services)
  • Can improve server scalability
  • Inherent support for request caching
  • Less reliant on tool support and heavyweight libraries
  • No need for additional messaging layer
  • Complexity at the endpoints instead of the transport layer level
22
Q

What are some disadvantages of REST?

A
  • Service model not always easily mappable to REST verbs, uniform interface tailored to large-grain hypermedia data transfer
  • Looser in terms of defining the exposed service API and its semantics
  • Does not cover all WS standards (security, transactions, addressing, coordination, …)
23
Q

What is SOAP short for?

A

Simple Object Access Protocol

24
Q

How do you add credentials to a SOAP message?

A

1) Add it in the SOAP body - credentials need to be encoded in every parameter

2) Use the optional SOAP header.
–> use the mustUnderstand attribute so that the receiving body is able to interpret this header

25
Q

What are some reasons to use SOAP?

A

(to get clean, LOL)

  • SOAP exposes application logic as services
  • Need more formal ways of invoking services
  • Need stateful information
  • If you need one of the WS- extensions
26
Q

What are some requirements for SOAP Web Services?

A
  • Text protocol: needs to be readable on the wire
  • Object oriented: needs to describe components of a service
27
Q

SOAP is only linked with XML. What is XML?

A
  • Stateless and one-way
  • Significant overhead
  • Can be used to develop more complex “conversations”
  • One level above XML RPC
     Adds processing and extensibility models to the story
     Style for exchanging arbitrary data
  • The de facto standard in human readable text back then
28
Q

What is the Web Services Description Language (WSDL)?

A
  • XML grammar to specify collection of “access end points”
  • Designed to automate application-to-application interaction
  • Defines the communication protocol to be used at runtime
     Message format
     Methods to be invoked
     Parameter lists, return types
  • WSDL descriptions can be automatically generated for existing code
  • Stub classes can be generated from WSDL descriptions