Web Services
What are some of the different categories of HTTP response codes that can be sent in an HTTP response message?
100's - Information 200's - Success 300's - Redirection 400's - Client 500's - Server
What are some of the properties that the WSDL contains?
<defintions> - The root tag of the WSDL that defines the name of the web service, declares multiple namespaces used throughout the document and contains all of the following service elements: <types> - Contains the data types to be used in the messages in the form of XML schemas. <message> - Maps parameters and return types of web service methods. <portType> - An abstract set of operations mapped to one or more end points, defining the collection of operations for a binding. <binding> - The concrete protocol and data formats for the operations and messages defined for a particular port type; includes the encoding type and transport protocol. <service> - A collection of related end-points encompassing the service definitions in the file; map the binding to the port and include any extensibility definitions.
What is an annotation that can be used to implement custom exception handling for ResponseEntity objects?
@ResponseStatus - Used above a custom exception class to indicate what HTTP Status code & message should be sent back with a ResponseEntity object if it is thrown.
What annotation should you replace @Controller with to implement RESTful web services using Spring?
@RestController should be used. It makes it so @ResponseBody is no longer needed over the controller methods.
What is a SOAP message? What are some of the properties of a SOAP message?
A SOAP message is an XML file used for communication in SOAP. Properties include: <envelope> - A mandatory element that defines the start and end of the SOAP message. <header> - An optional element used to turn on security or transactions. <body> - A mandatory element that contains the data of the SOAP message. <fault> - An optional element that provides information about errors that occur while processing the message.
What is a Web Service
A web service is any piece of software that makes itself available over the internet via a standard protocol or messaging system.
What are the four types of WSDL bindings? Which one is not used?
Bindings can either be Remote Procedure Call style binding or a document style binding. RPC/Encoded, RPC/literal, Document/encoded (not used), and Document/literal.
What is the difference between the Contract-First and Contract-Last approaches to creating a SOAP service?
Contract-First - The implementation code is written from the WSDL Contract-Last - The WSDL is generated from the implementation code
What are some examples of key-value pairs that might be passed in an HTTP Request?
Examples include Accept, Cookie, User-Agent, and Referrer.
What are some examples of key-value pairs that might be passed in an HTTP Response?
Examples include Age, Location, or Server.
What are the two kinds of REST messages that can be exchanged between the web service and the client?
HTTP Request - Sent from the client to the web service HTTP Response - Sent from the web service back to the client.
What is Marshalling? What is Unmarshalling?
Marshalling - The process of transforming an object into its serializable version to be transmitted through the network Unmarshalling - The process of transforming the serialized version of an object
What are the two types of platform-independent ways to describe an error within a SOAP message?
Modeled - Maps an exception that is explicitly thrown from the business logic of some Java code. Unmodeled - Maps to a generic runtime exception that is generated at runtime when no buisiness logic fault is defined in the WSDL.
What is REST?
REST stands for Representational State Transfer. It is a web service that follows the SOA standard and uses HTTP as its main protocol
What are some of the properties contained within an HTTP Response message?
Response Code - Contains a status code indicating whether or not an HTTP request has been successfully completed. HTTP Version Response Header - Metadata of the response held as key-value pairs. Response Body - The representation of the resource returned.
What object in Spring can be used to send an HTTP response?
ResponseEntity<BodyObject>(Object, HttpStatus.OK)
What are some of the characteristics of Service Oriented Architecture services?
Reusable - Services can be used by multiple processes depending on their granularity Autonomous - Each service provides a business function that is independent of other services Loosely Coupled - A change on one service will not require a change in another service Platform-Independent - Both the client and the server systems can be on any platform that supports the service transport and interface requirements Location-Independent - Services are accessed via URL, and therefore may move over time without disruption to consuming systems Standards Based - Services are built, consumed, and described using standards
What is SOA?
SOA stands for Service Oriented Architecture. It is a software development model for distributed application components.
What is SOAP?
SOAP stands for Simple Object Access Protocol. It is an XML-based protocol for exchanging information between computers.
What are three major roles within the web service architecture that a service could fill?
Service Provider - Implements the service and makes it available on the internet Service Requester - Utilizes an existing web service by opening a network connection and sending a request Service Registry - A centralized directory of services where developers can publish new services or find existing ones
What library is used by Spring to automatically generate a SOAP service? Does the tool use, Contract-First, Contract-Last, or either approach?
The Apache CXF SOAP engine tool with JAX-WS is used to generate the SOAP service. The tool can generate a SOAP service using either approach.
What are some differences between SOAP and REST?
Tools - SOAP uses tools like Apache CXF that provide code and WSDL generation while REST is tool-less. Exception Handling - SOAP has exception handling built-in and configurable in the body of the message, while REST needs exception handling behavior to be provided through Spring. Contract - SOAP is contract-based (WSDL), while REST is not contract based (although you could do it through a WADL) Message - SOAP uses XML as its only media type, while REST allows JSON, XML and other media types. Atomicity - SOAP has transactions built-in, configurable in the header of the message, which can make messages become atomic, while REST does not perform atomic transactions, it just represents state. Protocol - SOAP can use almost any protocol, while REST can only use HTTP and HTTPS. Security - SOAP has security built-in, configurable in the message header, while REST can only be secured through HTTPS.
What are some of the properties contained within an HTTP Request message?
Verb - Indicates the executing HTTP method URI - Specifies the endpoint where a resource is located HTTP Version Request Header - Metadata of the request held as key-value pairs. Request Body - The message content or resource representation
What is a WSDL?
WSDL stands for Web Service Description Language. It is the contract XML file used by SOAP services that describes the web service.