public class MessageWrapper
extends com.sun.xml.ws.api.message.Message
| Constructor and Description |
|---|
MessageWrapper(com.sun.xml.stream.buffer.MutableXMLStreamBuffer msg,
boolean oneWay,
com.sun.xml.ws.api.message.MessageHeaders hdrs,
SecuredMessage sm) |
MessageWrapper(SecuredMessage sm,
boolean oneWay) |
| Modifier and Type | Method and Description |
|---|---|
MessageWrapper |
copy()
Creates a copy of a Message.
|
com.sun.xml.ws.api.message.AttachmentSet |
getAttachments()
Gets the attachments of this message
(attachments live outside a message.)
|
com.sun.xml.ws.api.message.HeaderList |
getHeaders()
Gets all the headers of this message.
|
String |
getPayloadLocalPart()
Gets the local name of the payload element.
|
String |
getPayloadNamespaceURI()
Gets the namespace URI of the payload element.
|
protected boolean |
hasAttachments()
Optimization hint for the derived class to check
if we may have some attachments.
|
boolean |
hasHeaders()
Returns true if headers are present in the message.
|
boolean |
hasPayload()
Returns true if a Message has a payload.
|
boolean |
isFault()
Returns true if this message is a fault.
|
boolean |
isOneWay(com.sun.xml.ws.api.model.wsdl.WSDLPort port)
Returns true if this message is a request message for a
one way operation according to the given WSDL.
|
SOAPMessage |
readAsSOAPMessage()
Creates the equivalent
SOAPMessage from this message. |
Source |
readEnvelopeAsSource()
Consumes this message including the envelope.
|
XMLStreamReader |
readPayload()
Reads the payload as a
XMLStreamReader
This consumes the message. |
<T> T |
readPayloadAsJAXB(com.sun.xml.bind.api.Bridge<T> bridge)
Reads the payload as a JAXB object according to the given
Bridge. |
<T> T |
readPayloadAsJAXB(Unmarshaller unmarshaller)
Reads the payload as a JAXB object by using the given unmarshaller.
|
<T> T |
readPayloadAsJAXB(com.sun.xml.ws.spi.db.XMLBridge<T> arg0) |
Source |
readPayloadAsSource()
Returns the payload as a
Source object. |
void |
writePayloadTo(XMLStreamWriter sw)
Writes the payload to StAX.
|
void |
writeTo(ContentHandler contentHandler,
ErrorHandler errorHandler)
Writes the whole SOAP envelope as SAX events.
|
void |
writeTo(XMLStreamWriter sw)
Writes the whole SOAP message (but not attachments)
to the given writer.
|
addSOAPMimeHeaders, assertOneWay, consume, copyFrom, generateMessageID, getFirstDetailEntryName, getID, getID, getMethod, getOperation, getOperation, getSOAPVersion, getTransportHeaders, getTransportHeaders, readAsSOAPMessage, setMessageMedadatapublic MessageWrapper(SecuredMessage sm, boolean oneWay)
public MessageWrapper(com.sun.xml.stream.buffer.MutableXMLStreamBuffer msg,
boolean oneWay,
com.sun.xml.ws.api.message.MessageHeaders hdrs,
SecuredMessage sm)
public boolean hasHeaders()
hasHeaders in class com.sun.xml.ws.api.message.Messagepublic com.sun.xml.ws.api.message.HeaderList getHeaders()
Message implementation is allowed to defer
the construction of MessageHeaders object. So
if you only want to check for the existence of any header
element, use hasHeaders().
getHeaders in class com.sun.xml.ws.api.message.Messagepublic com.sun.xml.ws.api.message.AttachmentSet getAttachments()
getAttachments in class com.sun.xml.ws.api.message.Messageprotected boolean hasAttachments()
hasAttachments in class com.sun.xml.ws.api.message.Messagepublic boolean isOneWay(@NotNull
com.sun.xml.ws.api.model.wsdl.WSDLPort port)
This method is functionally equivalent as doing
getOperation(port).getOperation().isOneWay()
(with proper null check and all.) But this method
can sometimes work faster than that (for example,
on the client side when used with SEI.)
isOneWay in class com.sun.xml.ws.api.message.Messageport - Messages are always created under the context of
one WSDLPort and they never go outside that context.
Pass in that "governing" WSDLPort object here.
We chose to receive this as a parameter instead of
keeping WSDLPort in a message, just to save the storage.
The implementation of this method involves caching the return
value, so the behavior is undefined if multiple callers provide
different WSDLPort objects, which is a bug of the caller.
public String getPayloadLocalPart()
getPayloadLocalPart in class com.sun.xml.ws.api.message.Messagepublic boolean isFault()
Just a convenience method built on getPayloadNamespaceURI()
and getPayloadLocalPart().
isFault in class com.sun.xml.ws.api.message.Messagepublic String getPayloadNamespaceURI()
getPayloadNamespaceURI in class com.sun.xml.ws.api.message.Messagepublic boolean hasPayload()
A message without a payload is a SOAP message that looks like:
<xmp>
<S:Envelope>
<S:Header>
...
</S:Header>
<S:Body />
</S:Envelope>
</xmp>
hasPayload in class com.sun.xml.ws.api.message.Messagepublic Source readEnvelopeAsSource()
Source object.readEnvelopeAsSource in class com.sun.xml.ws.api.message.Messagepublic Source readPayloadAsSource()
Source object.
This consumes the message.readPayloadAsSource in class com.sun.xml.ws.api.message.Messagepublic SOAPMessage readAsSOAPMessage() throws SOAPException
SOAPMessage from this message.
This consumes the message.readAsSOAPMessage in class com.sun.xml.ws.api.message.MessageSOAPException - if there's any error while creating a SOAPMessage.public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException
readPayloadAsJAXB in class com.sun.xml.ws.api.message.MessageJAXBException - If JAXB reports an error during the processing.public <T> T readPayloadAsJAXB(com.sun.xml.bind.api.Bridge<T> bridge)
throws JAXBException
Bridge.
This consumes the message.readPayloadAsJAXB in class com.sun.xml.ws.api.message.MessageJAXBException - If JAXB reports an error during the processing.public XMLStreamReader readPayload() throws XMLStreamException
XMLStreamReader
This consumes the message.readPayload in class com.sun.xml.ws.api.message.MessageXMLStreamReader that points to
the payload tag name.XMLStreamExceptionpublic void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException
XMLStreamWriter.writeStartDocument()
nor
XMLStreamWriter.writeEndDocument()
If there's no payload, this method is no-op.
writePayloadTo in class com.sun.xml.ws.api.message.MessageXMLStreamException - If the XMLStreamWriter reports an error,
or some other errors happen during the processing.public void writeTo(XMLStreamWriter sw) throws XMLStreamException
writeTo in class com.sun.xml.ws.api.message.MessageXMLStreamException - If the XMLStreamWriter reports an error,
or some other errors happen during the processing.public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException
This consumes the message.
writeTo in class com.sun.xml.ws.api.message.MessagecontentHandler - must not be nulll.errorHandler - must not be null.
any error encountered during the SAX event production must be
first reported to this error handler. Fatal errors can be then
thrown as SAXParseException. SAXExceptions thrown
from ErrorHandler should propagate directly through this method.SAXExceptionpublic MessageWrapper copy()
This method creates a new Message whose header/payload/attachments/properties are identical to this Message. Once created, the created Message and the original Message behaves independently --- adding header/ attachment to one Message doesn't affect another Message at all.
This method does NOT consume a message.
To enable efficient copy operations, there's a few restrictions on how copied message can be used.
A 'life scope' of a message created during a message processing in a pipeline is until a pipeline processes the next message. A message cannot be kept beyond its life scope. (This experimental design is to allow message objects to be reused --- feedback appreciated.)
Since a Message body is read-once, sometimes (such as when you do fail-over, or WS-RM) you need to create an idential copy of a Message.
The actual copy operation depends on the layout of the data in memory, hence it's best to be done by the Message implementation itself.
The restrictions placed on the use of copied Message can be relaxed if necessary, but it will make the copy method more expensive.
copy in class com.sun.xml.ws.api.message.Messagepublic <T> T readPayloadAsJAXB(com.sun.xml.ws.spi.db.XMLBridge<T> arg0)
throws JAXBException
readPayloadAsJAXB in class com.sun.xml.ws.api.message.MessageJAXBExceptionCopyright © 2005–2018 Oracle Corporation. All rights reserved.