12.07.2015 Views

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 14 ■ SOAP WEB SERVICESSOAPWSDL describes an abstract interface of the web service, while SOAP provides a concreteimplementation, defining the XML structure of the messages exchanged. In relation to the Web, SOAP isa web service message structure that can be delivered over HTTP (or other communication protocols),and the HTTP binding of SOAP includes some standard HTTP extension headers. This message structureis described in XML. Instead of using HTTP to request a web page from a browser, SOAP sends an XMLmessage via HTTP request and receives a reply via HTTP response. A SOAP message is an XMLdocument containing the following elements:• : Defines the message and the namespace used in the document. Thisis a required root element.• : Contains any optional attributes of the message or application-specificinfrastructure such as security information or network routing.• : Contains the message being exchanged between applications.• : Provides information about errors that occur while the message isprocessed. This element is optional.Only the envelope and the body are required. Using our example, a client application calls the webservice to validate a credit card (one SOAP envelope for the request) and receives a Boolean informingwhether the card is valid or not (another SOAP envelope for the response). Listings 14-12 and 14-13 showthe structure of these two SOAP messages.Listing 14-12. The SOAP Envelope for the Request123410/109999VISAListing 14-13. The SOAP Envelope for the Responsetrue431

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!