Java Reference
In-Depth Information
2. Create a LibraryClientSAAJ application that uses SAAJ to perform
the equivalent of LibraryClient 's tasks. Use SOAPMessage 's
writeTo() method to output each of the request and response messages
for the addBook and getTitle operations.
3. The RESTful web service described by Listing 11-11 's Library class is
flawedinthatthe doDelete() methoddoesn'tnotifytheclientwhenre-
questedtodeleteanonexistentbook.Howmightyoumodifythismethodto
report this attempt?
Summary
Webservicesareserver-basedapplications/softwarecomponentsthatexposeWebre-
sources to clients via exchanges of messages. Companies use web services because
they overcome traditional middleware problems by being based on free and open
standards,bytheirmaintainability,byinvolvingtheWeb,andbybeingflexible.Fur-
thermore,theyhelpcompaniespreservetheirsignificantinvestmentsinlegacysoft-
ware.
Web services largely fall into two categories: SOAP-based and RESTful. SOAP-
based web services involve the flow of XML messages formatted according to the
SOAP XML language protocol between endpoints, which combine network ad-
dresses with bindings, where a binding provides concrete details on how an inter-
faceofoperations (whereanoperationconsistsofmessages) isboundtotheSOAP
messagingprotocoltocommunicatecommands,errorcodes,andotheritemsoverthe
wire.
SOAP-basedwebservicestypicallyrelyonWSDLdocumentstoidentifytheoper-
ationsprovidedbytheservice.AnXML-basedWSDLdocumentservesasaformal
contractbetweenaSOAP-basedwebserviceanditsclients,providingallthedetails
neededtointeractwiththewebservice.Thisdocumentletsyougroupmessagesinto
operations and operations into interfaces. It also lets you define a binding for each
interface as well as the endpoint address.
A RESTful web service is based on the REST software architecture style for the
WorldWideWeb.ThecentralpartofRESTistheURI-identifiable resource.REST
identifies resources by their MIME types (e.g., text/xml ). Also, resources have
states that are captured by their representations. When a client requests a resource
fromaRESTfulwebservice,theservicesendsaMIME-typedrepresentationofthe
resource to the client. Clients use HTTP's POST , GET , PUT , and DELETE verbs to
retrieverepresentationsofandmanipulateresources—RESTviewstheseverbsasan
API and maps them onto the database CRUD operations.
Search WWH ::




Custom Search