java.lang.Object
com.sun.xml.ws.api.message.Messages
Factory methods for various
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.
- Author:
- Kohsuke Kawaguchi
-
Method Summary
Modifier and TypeMethodDescriptionstatic Message
create
(com.sun.xml.stream.buffer.XMLStreamBuffer xsb) Creates aMessage
fromXMLStreamBuffer
that retains the whole envelope infoset.static Message
create
(SOAPVersion soapVersion, jakarta.xml.ws.ProtocolException pex, QName faultcode) static Message
create
(jakarta.xml.bind.JAXBContext context, Object jaxbObject, SOAPVersion soapVersion) Deprecated.static Message
create
(jakarta.xml.soap.SOAPFault fault) Creates a faultMessage
.static Message
create
(jakarta.xml.soap.SOAPMessage saaj) Creates aMessage
backed by a SAAJSOAPMessage
object.static Message
create
(String unsupportedAction, AddressingVersion av, SOAPVersion sv) Creates a faultMessage
that captures the code/subcode/subsubcode defined by WS-Addressing if wsa:Action is not supported.static Message
create
(Throwable t, SOAPVersion soapVersion) Creates aMessage
that represents an exception as a fault.static Message
create
(XMLStreamReader reader) Creates aMessage
fromXMLStreamReader
that points to the start of the envelope.static Message
create
(Source envelope, SOAPVersion soapVersion) Creates aMessage
using Source as entire envelope.static Message
static Message
createAddressingFaultMessage
(WSBinding binding, Packet p, QName missingHeader) Creates a faultMessage
that captures the code/subcode/subsubcode defined by WS-Addressing if one of the expected WS-Addressing headers is missing in the messagestatic Message
createAddressingFaultMessage
(WSBinding binding, QName missingHeader) Deprecated.static Message
createEmpty
(SOAPVersion soapVersion) Creates aMessage
that doesn't have any payload.static Message
createRaw
(jakarta.xml.bind.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
(XMLStreamReader payload, SOAPVersion ver) Creates aMessage
usingXMLStreamReader
as payload.static Message
createUsingPayload
(Source payload, SOAPVersion ver) static Message
createUsingPayload
(Element payload, SOAPVersion ver)
-
Method Details
-
create
@Deprecated public static Message create(jakarta.xml.bind.JAXBContext context, Object jaxbObject, SOAPVersion soapVersion) Deprecated.Creates aMessage
backed by a JAXB bean.- Parameters:
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 aJAXBElement
or an instanceof a class withXmlRootElement
).soapVersion
- The SOAP version of the message. Must not be null.
-
createRaw
@Deprecated public static Message createRaw(jakarta.xml.bind.JAXBContext context, Object jaxbObject, SOAPVersion soapVersion) Deprecated.For use when creating a Dispatch object with an unknown JAXB implementation for he JAXBContext parameter. -
create
Creates aMessage
backed by a SAAJSOAPMessage
object.If the
SOAPMessage
contains headers and attachments, this method does the right thing. -
createUsingPayload
-
createUsingPayload
Creates aMessage
usingXMLStreamReader
as payload.- Parameters:
payload
- XMLStreamReader payload isMessage
's payload Must not be null. Once this method is invoked, the createdMessage
will own theXMLStreamReader
, so it shall never be touched directly.ver
- The SOAP version of the message. Must not be null.
-
createUsingPayload
- Parameters:
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.
-
create
- Parameters:
soapEnvelope
- The SOAP envelope element.
-
create
Creates aMessage
using Source as entire envelope. -
createEmpty
Creates aMessage
that doesn't have any payload. -
create
Creates aMessage
fromXMLStreamReader
that points to the start of the envelope.- Parameters:
reader
- can point to the start document or the start element (of <s:Envelope>)
-
create
Creates aMessage
fromXMLStreamBuffer
that retains the whole envelope infoset.- Parameters:
xsb
- This buffer must contain the infoset of the whole envelope.
-
create
Creates aMessage
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 faultCode- Returns:
- Always non-null. A message that wraps this
Throwable
.
-
create
Creates a faultMessage
.This method is not designed for efficiency, and we don't expect to be used for the performance critical codepath.
- Parameters:
fault
- The populated SAAJ data structure that represents a fault in detail.- Returns:
- Always non-null. A message that wraps this
SOAPFault
.
-
createAddressingFaultMessage
@Deprecated public static Message createAddressingFaultMessage(WSBinding binding, QName missingHeader) Deprecated. -
createAddressingFaultMessage
public static Message createAddressingFaultMessage(WSBinding binding, Packet p, QName missingHeader) Creates a faultMessage
that captures the code/subcode/subsubcode defined by WS-Addressing if one of the expected WS-Addressing headers is missing in the message- Parameters:
binding
- WSBindingp
-Packet
that was missing a WS-Addressing header.missingHeader
- The missing WS-Addressing Header- Returns:
- A message representing SOAPFault that contains the WS-Addressing code/subcode/subsubcode.
-
create
public static Message create(@NotNull String unsupportedAction, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) Creates a faultMessage
that captures the code/subcode/subsubcode defined by WS-Addressing if wsa:Action is not supported.- Parameters:
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.- Returns:
- A message representing SOAPFault that contains the WS-Addressing code/subcode/subsubcode.
-
create
@NotNull public static Message create(@NotNull SOAPVersion soapVersion, @NotNull jakarta.xml.ws.ProtocolException pex, @Nullable QName faultcode) - Parameters:
soapVersion
-SOAPVersion.SOAP_11
orSOAPVersion.SOAP_12
pex
- a ProtocolExceptionfaultcode
- soap faultcode. Its ignored if theProtocolException
instance isSOAPFaultException
and it has a faultcode present in the underlyingSOAPFault
.- Returns:
Message
representing SOAP fault
-
createAddressingFaultMessage(WSBinding, Packet, QName)