Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tip

If you do not provide the @ServiceMode annotation, the Provider implementation will default to using payload mode.

Data Types

Overview

Provider implementations, because they are low-level objects, cannot use the same JAXB generated types as the higher level consumer APIs. Provider implementations work with the following types of objects:

  • javax.xml.transform.Source
  • javax.xml.soap.SOAPMessage
  • javax.activation.DataSource

Using Source objects

A Provider implementation can accept and return objects that are derived from the javax.xml.transform.Source interface. Source objects are low level objects that hold XML documents. Each Source implementation provides methods that access the stored XML documents and manipulate its contents. The following objects implement the Source interface:

  • DOMSource holds XML messages as a Document Object Model(DOM) tree. The XML message is stored as a set of Node objects that can be accessed using the getNode() method. Nodes can be updated or added to the DOM tree using the setNode() method.
  • SAXSource holds XML messages as a Simple API for XML (SAX) object. SAX objects contain an InputSource object that contains the raw data and an XMLReader object that parses the raw data.
  • StreamSource holds XML messages as a data stream. The data stream can be manipulated as would any other data stream.
    Info

    When using Source objects the developer is responsible for ensuring that all required binding specific wrappers are added to the message. For example, when interacting with a service expecting SOAP messages, the developer must ensure that the required SOAP envelope is added to the outgoing request and that the SOAP envelope's contents are correct.

Using SOAPMessage objects

Provider implementations can use javax.xml.soap.SOAPMessage objects when the following conditions are true:

  • the Provider implementation is using the SOAP binding.
  • the Provider implementation is using message mode.

A SOAPMessage object, as the name implies, holds a SOAP message. They contain one SOAPPart object and zero or more AttachmentPart objects. The SOAPPart object contains the SOAP specific portions of the SOAP message including the SOAP envelope, any SOAP headers, and the SOAP message body. The AttachmentPart objects contain binary data that was passed as an attachment.

Using DataSource objects

Provider implementations can use objects that implement the javax.activation.DataSource interface when the following conditions are true:

  • the implementation is using the HTTP binding.
  • the implementation is using message mode.

DataSource objects provide a mechanism for working with MIME typed data from a variety of sources including URLs, files, and byte arrays.