- java.lang.Object
-
- com.sun.xml.ws.api.message.Messages
-
public abstract class Messages extends Object
Factory methods for variousMessageimplementations.This class provides various methods to create different flavors of
Messageclasses that store data in different formats.This is a part of the JAX-WS RI internal API so that
Tubeimplementations 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
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Messagecreate(com.sun.xml.stream.buffer.XMLStreamBuffer xsb)Creates aMessagefromXMLStreamBufferthat retains the whole envelope infoset.static Messagecreate(SOAPVersion soapVersion, ProtocolException pex, QName faultcode)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(JAXBContext context, Object jaxbObject, SOAPVersion soapVersion)Deprecated.static Messagecreate(Marshaller marshaller, Object jaxbObject, SOAPVersion soapVersion)Deprecated.Use#create(JAXBRIContext, Object, SOAPVersion)static Messagecreate(SOAPFault fault)Creates a faultMessage.static Messagecreate(SOAPMessage saaj)Creates aMessagebacked by a SAAJSOAPMessageobject.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 Messagecreate(Element soapEnvelope)static 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(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 Detail
-
create
public static Message create(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
public 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.
-
create
public static Message create(Marshaller marshaller, Object jaxbObject, SOAPVersion soapVersion)
Deprecated.Use#create(JAXBRIContext, Object, SOAPVersion)
-
create
public static Message create(SOAPMessage saaj)
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
public static Message createUsingPayload(Source payload, SOAPVersion ver)
-
createUsingPayload
public static Message createUsingPayload(XMLStreamReader payload, SOAPVersion ver)
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
public static Message createUsingPayload(Element payload, SOAPVersion ver)
- 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
public static Message create(Element soapEnvelope)
- Parameters:
soapEnvelope- The SOAP envelope element.
-
create
public static Message create(Source envelope, SOAPVersion soapVersion)
Creates aMessageusing Source as entire envelope.
-
createEmpty
public static Message createEmpty(SOAPVersion soapVersion)
Creates aMessagethat doesn't have any payload.
-
create
@NotNull public static Message create(@NotNull XMLStreamReader reader)
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
@NotNull public static Message create(@NotNull com.sun.xml.stream.buffer.XMLStreamBuffer xsb)
Creates aMessagefromXMLStreamBufferthat retains the whole envelope infoset.- Parameters:
xsb- This buffer must contain the infoset of the whole envelope.
-
create
public static Message create(Throwable t, SOAPVersion soapVersion)
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
public static Message create(SOAPFault fault)
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
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
-
-