com.sun.xml.ws.api.message
Class Messages

java.lang.Object
  extended by com.sun.xml.ws.api.message.Messages

public abstract class Messages
extends java.lang.Object

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.


Method Summary
static Message create(org.w3c.dom.Element soapEnvelope)
          Creates a Message from an Element that represents the whole SOAP message.
static Message create(javax.xml.bind.JAXBContext context, java.lang.Object jaxbObject, SOAPVersion soapVersion)
          Deprecated.  
static Message create(javax.xml.bind.Marshaller marshaller, java.lang.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, javax.xml.ws.ProtocolException pex, javax.xml.namespace.QName faultcode)
          To be called to convert a ProtocolException and faultcode for a given SOAPVersion in to a Message.
static Message create(javax.xml.transform.Source envelope, SOAPVersion soapVersion)
          Creates a Message using Source as entire envelope.
static Message create(java.lang.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(java.lang.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, javax.xml.namespace.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, javax.xml.namespace.QName missingHeader)
          Deprecated. Use createAddressingFaultMessage(WSBinding, Packet, QName)
static Message createEmpty(SOAPVersion soapVersion)
          Creates a Message that doesn't have any payload.
static Message createRaw(javax.xml.bind.JAXBContext context, java.lang.Object jaxbObject, SOAPVersion soapVersion)
          Deprecated. For use when creating a Dispatch object with an unknown JAXB implementation for he JAXBContext parameter.
static Message createUsingPayload(org.w3c.dom.Element payload, SOAPVersion ver)
          Creates a Message from an Element that represents a payload.
static Message createUsingPayload(javax.xml.transform.Source payload, SOAPVersion ver)
          Creates a Message using Source as payload.
static Message createUsingPayload(javax.xml.stream.XMLStreamReader payload, SOAPVersion ver)
          Creates a Message using XMLStreamReader as payload.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Message create(javax.xml.bind.JAXBContext context,
                             java.lang.Object jaxbObject,
                             SOAPVersion soapVersion)
Deprecated. 

Creates a Message 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 a JAXBElement or an instanceof a class with XmlRootElement).
soapVersion - The SOAP version of the message. Must not be null.

createRaw

public static Message createRaw(javax.xml.bind.JAXBContext context,
                                java.lang.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(javax.xml.bind.Marshaller marshaller,
                             java.lang.Object jaxbObject,
                             SOAPVersion soapVersion)
Deprecated. Use #create(JAXBRIContext, Object, SOAPVersion)


create

public static Message create(javax.xml.soap.SOAPMessage saaj)
Creates a Message backed by a SAAJ SOAPMessage object.

If the SOAPMessage contains headers and attachments, this method does the right thing.

Parameters:
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.

createUsingPayload

public static Message createUsingPayload(javax.xml.transform.Source payload,
                                         SOAPVersion ver)
Creates a Message using Source as payload.

Parameters:
payload - Source payload is Message's payload Must not be null. Once this method is invoked, the created Message will own the Source, so it shall never be touched directly.
ver - The SOAP version of the message. Must not be null.

createUsingPayload

public static Message createUsingPayload(javax.xml.stream.XMLStreamReader payload,
                                         SOAPVersion ver)
Creates a Message using XMLStreamReader as payload.

Parameters:
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.

createUsingPayload

public static Message createUsingPayload(org.w3c.dom.Element payload,
                                         SOAPVersion ver)
Creates a Message from an Element that represents a payload.

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(org.w3c.dom.Element soapEnvelope)
Creates a Message from an Element that represents the whole SOAP message.

Parameters:
soapEnvelope - The SOAP envelope element.

create

public static Message create(javax.xml.transform.Source envelope,
                             SOAPVersion soapVersion)
Creates a Message using Source as entire envelope.

Parameters:
envelope - Source envelope is used to create Message Must not be null. Once this method is invoked, the created Message will own the Source, so it shall never be touched directly.

createEmpty

public static Message createEmpty(SOAPVersion soapVersion)
Creates a Message that doesn't have any payload.


create

@NotNull
public static Message create(@NotNull
                                     javax.xml.stream.XMLStreamReader reader)
Creates a Message from XMLStreamReader that 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 a Message from XMLStreamBuffer that retains the whole envelope infoset.

Parameters:
xsb - This buffer must contain the infoset of the whole envelope.

create

public static Message create(java.lang.Throwable t,
                             SOAPVersion soapVersion)
Creates a 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 faultCode

Returns:
Always non-null. A message that wraps this Throwable.

create

public static Message create(javax.xml.soap.SOAPFault fault)
Creates a fault Message.

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,
                                                   javax.xml.namespace.QName missingHeader)
Deprecated. Use createAddressingFaultMessage(WSBinding, Packet, QName)


createAddressingFaultMessage

public static Message createAddressingFaultMessage(WSBinding binding,
                                                   Packet p,
                                                   javax.xml.namespace.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

Parameters:
binding - WSBinding
p - 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
                             java.lang.String unsupportedAction,
                             @NotNull
                             AddressingVersion av,
                             @NotNull
                             SOAPVersion sv)
Creates a fault Message 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
                                     javax.xml.ws.ProtocolException pex,
                                     @Nullable
                                     javax.xml.namespace.QName faultcode)
To be called to convert a ProtocolException and faultcode for a given SOAPVersion in to a Message.

Parameters:
soapVersion - SOAPVersion.SOAP_11 or SOAPVersion.SOAP_12
pex - a ProtocolException
faultcode - soap faultcode. Its ignored if the ProtocolException instance is SOAPFaultException and it has a faultcode present in the underlying SOAPFault.
Returns:
Message representing SOAP fault


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.