public abstract class Messages extends Object
Message
implementations.
This class provides various methods to create different
flavors of Message
classes that store data
in different formats.
This is a part of the JAX-WS RI internal API so that
Tube
implementations can reuse the implementations
done inside the JAX-WS.
If you find some of the useful convenience methods missing from this class, please talk to us.
Modifier and Type | Method and Description |
---|---|
static Message |
create(Element soapEnvelope)
|
static Message |
create(JAXBContext context,
Object jaxbObject,
SOAPVersion soapVersion)
Deprecated.
|
static Message |
create(Marshaller marshaller,
Object jaxbObject,
SOAPVersion soapVersion)
Deprecated.
Use
#create(JAXBRIContext, Object, SOAPVersion) |
static Message |
create(javax.xml.soap.SOAPFault fault)
Creates a fault
Message . |
static Message |
create(javax.xml.soap.SOAPMessage saaj)
Creates a
Message backed by a SAAJ SOAPMessage object. |
static Message |
create(SOAPVersion soapVersion,
ProtocolException pex,
QName faultcode)
|
static Message |
create(Source envelope,
SOAPVersion soapVersion)
Creates a
Message using Source as entire envelope. |
static Message |
create(String unsupportedAction,
AddressingVersion av,
SOAPVersion sv)
Creates a fault
Message that captures the code/subcode/subsubcode
defined by WS-Addressing if wsa:Action is not supported. |
static Message |
create(Throwable t,
SOAPVersion soapVersion)
Creates a
Message that represents an exception as a fault. |
static Message |
create(com.sun.xml.stream.buffer.XMLStreamBuffer xsb)
Creates a
Message from XMLStreamBuffer that retains the
whole envelope infoset. |
static Message |
create(javax.xml.stream.XMLStreamReader reader)
Creates a
Message from XMLStreamReader that points to
the start of the envelope. |
static Message |
createAddressingFaultMessage(WSBinding binding,
Packet p,
QName missingHeader)
Creates a fault
Message that captures the code/subcode/subsubcode
defined by WS-Addressing if one of the expected WS-Addressing headers is
missing in the message |
static Message |
createAddressingFaultMessage(WSBinding binding,
QName missingHeader)
Deprecated.
|
static Message |
createEmpty(SOAPVersion soapVersion)
Creates a
Message that doesn't have any payload. |
static Message |
createRaw(JAXBContext context,
Object jaxbObject,
SOAPVersion soapVersion)
Deprecated.
For use when creating a Dispatch object with an unknown JAXB implementation
for he JAXBContext parameter.
|
static Message |
createUsingPayload(Element payload,
SOAPVersion ver)
|
static Message |
createUsingPayload(Source payload,
SOAPVersion ver)
|
static Message |
createUsingPayload(javax.xml.stream.XMLStreamReader payload,
SOAPVersion ver)
Creates a
Message using XMLStreamReader as payload. |
public static Message create(JAXBContext context, Object jaxbObject, SOAPVersion soapVersion)
Message
backed by a JAXB bean.context
- The context to be used to produce infoset from the object. Must not be null.jaxbObject
- The JAXB object that represents the payload. must not be null. This object
must be bound to an element (which means it either is a JAXBElement
or
an instanceof a class with XmlRootElement
).soapVersion
- The SOAP version of the message. Must not be null.public static Message createRaw(JAXBContext context, Object jaxbObject, SOAPVersion soapVersion)
public static Message create(Marshaller marshaller, Object jaxbObject, SOAPVersion soapVersion)
#create(JAXBRIContext, Object, SOAPVersion)
public static Message create(javax.xml.soap.SOAPMessage saaj)
Message
backed by a SAAJ SOAPMessage
object.
If the SOAPMessage
contains headers and attachments, this method
does the right thing.
saaj
- The SOAP message to be represented as a Message
.
Must not be null. Once this method is invoked, the created
Message
will own the SOAPMessage
, so it shall
never be touched directly.public static Message createUsingPayload(Source payload, SOAPVersion ver)
public static Message createUsingPayload(javax.xml.stream.XMLStreamReader payload, SOAPVersion ver)
Message
using XMLStreamReader
as payload.payload
- XMLStreamReader payload is Message
's payload
Must not be null. Once this method is invoked, the created
Message
will own the XMLStreamReader
, so it shall
never be touched directly.ver
- The SOAP version of the message. Must not be null.public static Message createUsingPayload(Element payload, SOAPVersion ver)
payload
- The element that becomes the child element of the SOAP body.
Must not be null.ver
- The SOAP version of the message. Must not be null.public static Message create(Element soapEnvelope)
soapEnvelope
- The SOAP envelope element.public static Message create(Source envelope, SOAPVersion soapVersion)
Message
using Source as entire envelope.public static Message createEmpty(SOAPVersion soapVersion)
Message
that doesn't have any payload.@NotNull public static Message create(@NotNull javax.xml.stream.XMLStreamReader reader)
Message
from XMLStreamReader
that points to
the start of the envelope.reader
- can point to the start document or the start element (of <s:Envelope>)@NotNull public static Message create(@NotNull com.sun.xml.stream.buffer.XMLStreamBuffer xsb)
Message
from XMLStreamBuffer
that retains the
whole envelope infoset.xsb
- This buffer must contain the infoset of the whole envelope.public static Message create(Throwable t, SOAPVersion soapVersion)
Message
that represents an exception as a fault. The
created message reflects if t or t.getCause() is SOAPFaultException.
creates a fault message with default faultCode env:Server if t or t.getCause()
is not SOAPFaultException. Otherwise, it use SOAPFaultException's faultCodeThrowable
.public static Message create(javax.xml.soap.SOAPFault fault)
Message
.
This method is not designed for efficiency, and we don't expect to be used for the performance critical codepath.
fault
- The populated SAAJ data structure that represents a fault
in detail.SOAPFault
.public static Message createAddressingFaultMessage(WSBinding binding, QName missingHeader)
createAddressingFaultMessage(WSBinding, Packet, QName)
public static Message createAddressingFaultMessage(WSBinding binding, Packet p, QName missingHeader)
Message
that captures the code/subcode/subsubcode
defined by WS-Addressing if one of the expected WS-Addressing headers is
missing in the messagebinding
- WSBindingp
- Packet
that was missing a WS-Addressing header.missingHeader
- The missing WS-Addressing Headerpublic static Message create(@NotNull String unsupportedAction, @NotNull AddressingVersion av, @NotNull SOAPVersion sv)
Message
that captures the code/subcode/subsubcode
defined by WS-Addressing if wsa:Action is not supported.unsupportedAction
- The unsupported Action. Must not be null.av
- The WS-Addressing version of the message. Must not be null.sv
- The SOAP Version of the message. Must not be null.@NotNull public static Message create(@NotNull SOAPVersion soapVersion, @NotNull ProtocolException pex, @Nullable QName faultcode)
soapVersion
- SOAPVersion.SOAP_11
or SOAPVersion.SOAP_12
pex
- a ProtocolExceptionfaultcode
- soap faultcode. Its ignored if the ProtocolException
instance is SOAPFaultException
and it has a
faultcode present in the underlying SOAPFault
.Message
representing SOAP faultCopyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.