Handlers and Faults in the predictionsSOAP Service
This section ports the various REST-style versions of the predictions web service to a SOAP-based version. The new version is predictionsSOAP, whose structure can be summarized as follows:
- There is a service client and a client-side message handler. The handler inserts an HMAC hash into every client request against the predictionsSOAP service. However, the handler departs from the Amazon practice by inserting the hash into the SOAP header rather than the SOAP body.
- The client, built atop wsimport-generated classes, invokes various CRUD operations in the predictionsSOAP service.
- There is a service-side message handler whose job is to verify the HMAC hash from the client.
- The service implements the standard CRUD operations.
-
The service throws SOAP faults from both the handler and the application level in order
to contrast the two different APIs. As the name suggests, a SOAP fault signals an
error condition; the fault is a special message sent back to the client in place of an error-free SOAP response. The
service WSDL indicates, in the
portType
section, that a client request may result in a fault message rather than a standard response. The architecture of the predictionsSOAP service is sketched in Figure 5-5.
Figure 5-5. The architecture of the predictionsSOAP service
The predictionsSOAP service mirrors, in its structure, the SOAP-based ...
Get Java Web Services: Up and Running, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.