Web Services Flashcards

1
Q

What is a Web Service?

A

Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in java, shell script or any other different technologies.
Web services are stateless and doesn’t maintain user session like web applications.

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

What is SOA?

A

SOA is an architecture for building applications using reusable, interoperable services which have well defined business functionalities and can be orchestrated to achieve a specific functionality by utilizing them together.

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

What are Service Oriented Architecture?

A

Black boxes that are loosely coupled, and interdependent, does not rely on each other. Many small black boxes that are connected to each other

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

Difference between SOAP and Rest

A
SOAP
Messaging: XML 
Transport: HTTP SMTD BEEP
Service Discovery: UDDI EBXML
Service Description: WEDL SEI (SERVICE ENDPOINT INTERFACE)
REST
Messaging: XML JSON HTML
Transport: HTTP HTTPS
Service Discovery: EUREKA
Service Description: WADL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Approaches to development of the enterprise Web Services

A

Contract-First vs. Contract-Last

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

What is Contract First?

A

Contract-first is where you create the WSDL first, and then you can create the implementation from this, and since the WSDL is your contract, this would be contract-first.

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

What is Contract Last?

A

Contract-last is where the WSDL is created from the source code, or implementation, so it will most likely be generated by a tool rather than created by the developer.

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

What is SOA?

A

SOA is an architecture for building business applications using loosely coupled services which act like black boxes and can be orchestrated to achieve a specific functionality by linking them together.

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

In SOA do we need to build systems from scratch?

A

No. If you need to integrate or make an existing system as a business service, you just need to create loosely coupled wrappers which will expose the systems functionality in a generic fashion.

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

What is SOAP?

A

SOAP (Simple Object Access Protocol) is a messaging protocol that allows programs that run on disparate operating systems (such as Windows and Linux) to communicate using Hypertext Transfer Protocol (HTTP) and its Extensible Markup Language (XML).

SOAP at one time stood for Simple Object Access Protocol. Starting with SOAP Version 1.2, the letters in the acronym have no particular meaning.

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

What does SOAP do?

A

SOAP specifies exactly how to encode an HTTP header and an XML file so that a program in one computer can call a program in another computer and pass along information. SOAP also specifies how the called program can return a response. Despite its frequent pairing with HTTP, SOAP supports other transport protocols as well.

SOAP enables applications to call functions from other applications, running on any hardware platform, regardless of different operating systems or programming languages.

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

How does SOAP send message over the internet?

A

Using the SOAP envelope

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

What is in the SOAP envelope?

A

The SOAP envelope contains two parts:

An optional header providing information on authentication, encoding of data, or how a recipient of a SOAP message should process the message.
The body that contains the message. These messages can be defined using the WSDL specification.

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

What does a WSDL document do?

A

A WSDL document describes a web service

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

What does a WSDL binding do?

A

A WSDL binding describes how the service is bound to a messaging protocol, particularly the SOAP messaging protocol.

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

What are the advantages of Web Services?

A

Interoperability: Web services are accessible over network and runs on HTTP/SOAP protocol and uses XML/JSON to transport data, hence it can be developed in any programming language. Web service can be written in java programming and client can be PHP and vice versa.

Reusability: One web service can be used by many client applications at the same time.

Loose Coupling: Web services client code is totally independent with server code, so we have achieved loose coupling in our application.

Easy to deploy and integrate, just like web applications.

Multiple service versions can be running at same time.

17
Q

What are different types of Web Services?

A

There are two types of web services:

SOAP Web Services: Runs on SOAP protocol and uses XML technology for sending data.

Restful Web Services: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services.

18
Q

Compare SOAP and REST web services?

A

SOAP
SOAP uses WSDL to expose supported methods and technical details.
SOAP is a standard protocol for creating web services.
SOAP is acronym for Simple Object Access Protocol.
SOAP web services and client programs are bind with WSDL contract
SOAP web services and client are tightly coupled with contract.
SOAP learning curve is hard, requires us to learn about WSDL generation, client stubs creation etc.
SOAP supports XML data format only
SOAP web services are hard to maintain, any change in WSDL contract requires us to create client stubs again and then make changes to client code.
SOAP web services can be tested through programs or software such as Soap UI.

REST
REST is an architectural style to create web services.
REST is acronym for REpresentational State Transfer.
REST exposes methods through URIs, there are no technical details.
REST doesn’t have any contract defined between server and client
REST web services are loosely coupled.
REST learning curve is simple, POJO classes can be generated easily and works on simple HTTP methods.
REST supports any data type such as XML, JSON, image etc.
REST web services are easy to maintain when compared to SOAP, a new method can be added without any change at client side for existing resources.
REST can be easily tested through CURL command, Browsers and extensions such as Chrome Postman.

19
Q

What are different ways to test web services?

A

SOAP web services can be tested programmatically by generating client stubs from WSDL or through software such as Soap UI.

REST web services can be tested easily with program, curl commands and through browser extensions. Resources supporting GET method can be tested with browser itself, without any program.

20
Q

Can we maintain user session in web services?

A

Web services are stateless so we can’t maintain user sessions in web services.

21
Q

What is difference between SOA and Web Services?

A

Service Oriented Architecture (SOA) is an architectural pattern where applications are designed in terms of services that can be accessed through communication protocol over network. SOA is a design pattern and doesn’t go into implementation.

Web Services can be thought of as Services in SOAP architecture and providing means to implement SOA pattern.

22
Q

How would you choose between SOAP and REST web services?

A

Web Services work on client-server model and when it comes to choose between SOAP and REST, it all depends on project requirements.

Do you know your web service clients beforehand? If Yes, then you can define a contract before implementation and SOAP seems better choice. But if you don’t then REST seems better choice because you can provide sample request/response and test cases easily for client applications to use later on.

For quick implementation REST is the best choice. You can create web service easily, test it through browser/curl and get ready for your clients.

What kind of data format are supported? If only XML then you can go with SOAP but if you think about supporting JSON also in future then go with REST.

23
Q

What is JAX-WS API?

A

JAX-WS stands for Java API for XML Web Services. JAX-WS is XML based Java API to build web services server and client application. It’s part of standard Java API, so we don’t need to include anything else which working with it.

24
Q

Name important annotations used in JAX-WS API?

A

Some of the important annotations used in JAX-WS API are:

@WebService
@SOAPBinding
@WebMethod

25
Q

What is use of javax.xml.ws.Endpoint class?

A

Endpoint class provides useful methods to create endpoint and publish existing implementation as web service. This comes handy in testing web services before making further changes to deploy it on actual server.

26
Q

What are the main features of SOA?

A

SOA separates business functions into services (endpoints), which are made accessible over a network in order to allow users to combine and reuse them in their applications.

The SOA services can be developed in different languages and OS’es as long as they follow the SOA principles.

Services are unassociated and loosely coupled units that do not directly rely on each other for their full functioning. Rather than services embedding calls to each other in their source code, they use defined protocols that describe how services pass and parse messages using description metadata.

Orchestration is a process where business functionality from various services are combined in a system fully aware of all available services and the associated metadata that defines these services and their characteristics.

27
Q

Mention the SOA Principles?

A

These 8 principles are underlying to any good architecture that utilizes SOA design to build their products and services:

Standardized service contract: Services adhere to a communications agreement, as defined collectively by one or more service-description documents.

Service loose coupling: Services maintain a relationship that minimizes dependencies and only requires that they maintain an awareness of each other.

Service abstraction: Beyond descriptions in the service contract, services hide logic from the outside world.

Service re-usability: Logic is divided into services with the intention of promoting reuse.

Service autonomy: Services have control over the logic they encapsulate.

Service statelessness: Services minimize resource consumption by deferring the management of state information when necessary

Service discoverability: Services are supplemented with communicative meta data by which they can be effectively discovered and interpreted.

Service composability: Services are effective composition participants, regardless of the size and complexity of the composition.

28
Q

What is a reusable Service?

A

It is an autonomous, reusable, discoverable, stateless functionality that has the necessary granularity, and can be part of a composite application or a composite service.

A reusable service should be identified with a business activity described by the service specifications (design-time contract).

A service’s constraints, including security, QoS, SLA, usage policies, may be defined by multiple run-time contracts, multiple interfaces (the WSDL for a SOAP Web Service), and multiple implementations (the code).

A reusable service should be governed at the enterprise level throughout its entire lifecycle, from design-time through run-time. Its reuse should be promoted through a prescriptive process, and that reuse should be measured.

29
Q

How can you achieve loose coupling in a SOA?

A

One strategy for achieving loose coupling is to use the service interface (the WSDL for a SOAP Web Service) to limit this dependency, hiding the service implementation from the consumer. Loose coupling can be addressed by encapsulating the service functionalities in a manner that limits the impact of changes to the implementation on the service interface.
However, at some point you will need to change the interface and manage versioning without impacting service consumers, in addition to managing multiple security constraints, multiple transports, and other considerations.

30
Q

What is a WSDL?

A

Web Services Description Language

31
Q

What does a WSDL do?

A

WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services). WSDL is extensible to allow description of endpoints and their messages regardless of what message formats or network protocols are used to communicate,