Web Services Flashcards Preview

JavaBatchReview > Web Services > Flashcards

Flashcards in Web Services Deck (11)
Loading flashcards...
1
Q

What is a Web Service?

A
  • A web service is any piece of software that makes itself available over the internet and uses a messaging system.
  • Web services are self contained, modular, distributed, dynamic applications that can be described published, located, or invoked over the network to create products, processes, and supply chains. These applications can be local, distributed, or web-based.
  • Uses a standardized XML messaging system at the very least.
2
Q

What is SOAP?

A
  • Simple object access protocol. Communication protocol to communicate via Internet.
  • supports XML messaging via any protocol.
  • Can be both stateless and stateful.
  • Built-in error handling.
  • XML document contains envelope, header, body, and fault.
3
Q

What is REST?

A
  • An architecture
  • Constraints defining a restful system
    • Client server architecture
    • Stateless
    • Cacheability
    • Layered system - a client can’t tell if it’s connected directly to the RESTful service or an intermediary
    • Code on demand - Servers can temporarily extend or customize the functionality of a client by transferring executable code
    • Uniform interface
4
Q

SOAP vs REST

A
  • SOAP clients are heavily coupled to the server, essentially have a rigid contract with each other
  • REST client is more generic, which knows how to use a protocol and standard methods (aka protocol independent)
5
Q

What is JAX-WS?

A

JAX-WS is used to build Web services and corresponding clients that communicate using XML to send messages or use remote procedure calls to exchange data between client and service provider.

6
Q

How do you create a SOAP Web Service?

A
  • Use JAX-WS
  • Service interface, add @WebService and @SOAPBinding
  • Implement service, add @WebService
  • Main method - publish endpoints (endpoint.publish), give it the url and instance of implementation class
  • Generate WSDL
7
Q

WSDL Tags in detail.

A
  • Definition − It is the root element of all WSDL documents. It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here.
  • Types − The data types to be used in the messages are in the form of XML schemas.
  • Message − It is an abstract definition of the data, in the form of a message presented either as an entire document or as arguments to be mapped to a method invocation.
  • Port type − It is an abstract set of operations mapped to one or more end-points, defining the collection of operations for a binding; the collection of operations, as it is abstract, can be mapped to multiple transports through various bindings.
  • Operation − It is the abstract definition of the operation for a message, such as naming a method, message queue, or business process, that will accept and process the message.
  • Binding − It is the concrete protocol and data formats for the operations and messages defined for a particular port type.
  • Service − It is a collection of related end-points encompassing the service definitions in the file; the services map the binding to the port and include any extensibility definitions.
8
Q

Is SOAP stateless?

A

yes

9
Q

What protocols does SOAP allow?

A

SOAP can operate over any protocol.

10
Q

What protocol does REST allow?

A

Only HTTP

11
Q

What are the tags in the SOAP fault?

A

1-It is a text code used to indicate a class of errors. See the next Table for a listing of predefined fault codes.
2-It is a text message explaining the error.
3-It is a text string indicating who caused the fault. It is useful if the SOAP message travels through several nodes in the SOAP message path, and the client needs to know which node caused the error. A node that does not act as the ultimate destination must include a faultActor element.
4-It is an element used to carry application-specific error messages. The detail element can contain child elements called detail entries.