Working with XML Messages

In this section, we’ll learn the basic Java techniques required to exchange XML data:

  • Over the Web in real time, by posting an XML message over HTTP to another server and immediately receiving an XML-based response

  • Asynchronously between processes, by enqueuing XML messages into and dequeuing them out of Oracle AQ queues

These two important tasks are fundamental to the implementation of web services, the business-to-business interchange of information using XML message formats and the HTTP protocol.

Sending and Receiving XML Between Servers

As we saw in Chapter 1, the general approach for moving information of any kind around the Web involves the exchange via requests and responses of text or binary resources over the HTTP protocol. A requester requests information by using its Uniform Resource Locator (URL) and a server handling requests for that URL responds appropriately, delivering the requested information or returning an error. HTTP’s request/response paradigm supports including a resource with the request as well as receiving a resource back in the response, so it’s a two-way street for information exchange.

Any resources being exchanged between requester and server are earmarked by a distinguishing MIME type so the receiver can understand what kind of information it is getting. The registered MIME type for XML-based information resources is text/xml . Putting it all together, the phrase “posting XML to another server” means precisely this: sending ...

Get Building Oracle XML Applications 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.