Package com.sun.xml.ws.api.message
Class Messages
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 Messagecreate(XMLStreamBuffer xsb) Creates aMessagefromXMLStreamBufferthat retains the whole envelope infoset.static Messagecreate(SOAPVersion soapVersion, ProtocolException pex, QName faultcode) static Messagecreate(jakarta.xml.bind.JAXBContext context, Object jaxbObject, SOAPVersion soapVersion) Deprecated.static MessageCreates a faultMessage.static Messagecreate(SOAPMessage saaj) Creates aMessagebacked by a SAAJSOAPMessageobject.static Messagecreate(String unsupportedAction, AddressingVersion av, SOAPVersion sv) Creates a faultMessagethat captures the code/subcode/subsubcode defined by WS-Addressing if wsa:Action is not supported.static Messagecreate(Throwable t, SOAPVersion soapVersion) Creates aMessagethat represents an exception as a fault.static Messagecreate(XMLStreamReader reader) Creates aMessagefromXMLStreamReaderthat points to the start of the envelope.static Messagecreate(Source envelope, SOAPVersion soapVersion) Creates aMessageusing Source as entire envelope.static Messagestatic MessagecreateAddressingFaultMessage(WSBinding binding, Packet p, QName missingHeader) Creates a faultMessagethat captures the code/subcode/subsubcode defined by WS-Addressing if one of the expected WS-Addressing headers is missing in the messagestatic MessagecreateAddressingFaultMessage(WSBinding binding, QName missingHeader) Deprecated.static MessagecreateEmpty(SOAPVersion soapVersion) Creates aMessagethat doesn't have any payload.static MessagecreateRaw(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 MessagecreateUsingPayload(XMLStreamReader payload, SOAPVersion ver) Creates aMessageusingXMLStreamReaderas payload.static MessagecreateUsingPayload(Source payload, SOAPVersion ver) static MessagecreateUsingPayload(Element payload, SOAPVersion ver)
-
Method Details
-
create
@Deprecated public static Message create(jakarta.xml.bind.JAXBContext context, Object jaxbObject, SOAPVersion soapVersion) Deprecated.Creates aMessagebacked 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 aJAXBElementor 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 aMessagebacked by a SAAJSOAPMessageobject.If the
SOAPMessagecontains headers and attachments, this method does the right thing.- Parameters:
saaj- The SOAP message to be represented as aMessage. Must not be null. Once this method is invoked, the createdMessagewill own theSOAPMessage, so it shall never be touched directly.
-
createUsingPayload
-
createUsingPayload
Creates aMessageusingXMLStreamReaderas payload.- Parameters:
payload- XMLStreamReader payload isMessage's payload Must not be null. Once this method is invoked, the createdMessagewill 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 aMessageusing Source as entire envelope. -
createEmpty
Creates aMessagethat doesn't have any payload. -
create
Creates aMessagefromXMLStreamReaderthat points to the start of the envelope.- Parameters:
reader- can point to the start document or the start element (of <s:Envelope>)
-
create
Creates aMessagefromXMLStreamBufferthat retains the whole envelope infoset.- Parameters:
xsb- This buffer must contain the infoset of the whole envelope.
-
create
Creates aMessagethat 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 faultMessagethat 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-Packetthat 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 faultMessagethat 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 ProtocolException pex, @Nullable QName faultcode) - Parameters:
soapVersion-SOAPVersion.SOAP_11orSOAPVersion.SOAP_12pex- a ProtocolExceptionfaultcode- soap faultcode. Its ignored if theProtocolExceptioninstance isSOAPFaultExceptionand it has a faultcode present in the underlyingSOAPFault.- Returns:
Messagerepresenting SOAP fault
-
createAddressingFaultMessage(WSBinding, Packet, QName)