Dispatch objects have two usage modes:
Message mode
Message Payload mode (Payload mode)
The usage mode you specify for a Dispatch object determines the amount of detail
that is passed to the user level code.
In message mode, a Dispatch object works with complete
messages. A complete message includes any binding specific headers and wrappers. For example, a consumer interacting with a
service that requires SOAP messages must provide the Dispatch object's
invoke() method a fully specified SOAP message. The
invoke() method also returns a fully specified SOAP message. The consumer code is responsible
for completing and reading the SOAP message's headers and the SOAP message's envelope information.
![]() | Tip |
|---|---|
Message mode is not ideal when working with JAXB objects. |
To specify that a Dispatch object uses message mode provide the value
java.xml.ws.Service.Mode.MESSAGE when creating the Dispatch
object. For more information about creating a Dispatch object see
Creating a Dispatch object.
In payload mode, also called message payload mode, a
Dispatch object works with only the payload of a message. For example, a
Dispatch object working in payload mode works only with the body of a SOAP message. The
binding layer processes any binding level wrappers and headers. When a result is returned from the
invoke() method the binding level wrappers and headers are already striped away, and only the
body of the message is left.
![]() | Tip |
|---|---|
When working with a binding that does not use special wrappers, such as the FUSE Services Framework XML binding, payload mode and message mode provide the same results. |
To specify that a Dispatch object uses payload mode provide the value
java.xml.ws.Service.Mode.PAYLOAD when creating the Dispatch
object. For more information about creating a Dispatch object see
Creating a Dispatch object.