Class MessageImpl
java.lang.Object
org.apache.axis2.jaxws.message.impl.MessageImpl
MessageImpl
A Message is an XML part + Attachments.
Most of the implementation delegates to the XMLPart implementation.
NOTE: For XML/HTTP (REST), a SOAP 1.1. Envelope is built and the rest payload is placed
in the body. This purposely mimics the Axis2 implementation.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataHandler(jakarta.activation.DataHandler dh, String id) Add AttachmentvoidappendHeaderBlock(String namespace, String localPart, Block block) appendHeaderBlock Append the block to the list of header blocks.voidclose()Used primarily to ensure the parser is forwarded to the end so it can be closed.org.apache.axiom.om.OMElementgetAsOMElement Get the xml part as a read/write OM...note this returns an OM SOAPEnvelope for all protocols...even RESTjakarta.xml.soap.SOAPEnvelopegetAsEnvelope Get the xml part as a read/write SOAPEnvelopejakarta.xml.soap.SOAPMessagegetAsSOAPMessage Get the xml part as a read/write SOAPEnvelopegetAttachmentID(int index) Get the indicated (non-soap part) attachment idgetAttachmentID(String partName) Get the indicated (non-soap part) attachment idGet the list of attachment content ids for the messagegetBodyBlock(int index, Object context, BlockFactory blockFactory) getBodyBlock Get the body block at the specificed index.getBodyBlock(Object context, BlockFactory blockFactory) getBodyBlock Get the single Body Block.getBodyBlockQNames Calling this method will cache the OM.jakarta.activation.DataHandlergetDataHandler(String cid) Get the attachment identified by the contentIDgetHeaderBlock(String namespace, String localPart, Object context, BlockFactory blockFactory) getHeaderBlock Get the firstheader block with the specified name.getHeaderBlocks(String namespace, String localPart, Object context, BlockFactory blockFactory, org.apache.axiom.soap.RolePlayer rolePlayer) getHeaderBlock Get the header blocks with the specified name The BlockFactory and object context are passed in to help create the proper kind of block.intGet indirection.intgetNumBodyBlocks Calling this method will cache the OM.intgetNumHeaderBlocksgetParent Get the Message object that this XMLPart is attached to, if it is attached to one at all.Get the protocol for this Message (soap11, soap12, etc.)jakarta.jws.soap.SOAPBinding.StylegetStyle()getValue(Object context, BlockFactory blockFactory) If the XMLPart represents a fault, an XMLFault is returned which describes the fault in a protocol agnostic mannerThe representation of the XMLPart may be in a number of different forms.getXMLStreamReader(boolean consume) Get the XMLStreamReader represented by this Message for the xml partbooleanisConsumed Return true if the part is consumed.booleanbooleanisFault()Determines whether the XMLPart represents a FaultbooleanA message is MTOM enabled if the associated dispatch/client/impl/provider has a binding type that enables MTOM.booleanvoidoutputTo(XMLStreamWriter writer, boolean consume) Write out the MessagevoidremoveBodyBlock(int index) removeBodyBlock Removes the indicated BodyBlockjakarta.activation.DataHandlerremoveDataHandler(String cid) Get the attachment and remove it from the MessagevoidremoveHeaderBlock(String namespace, String localPart) removeHeaderBlock Removes all header blocks with this namespace/localpartvoidsetBodyBlock(int index, Block block) setBodyBlock Set the block at the specified index Once set, the Message owns the block.voidsetBodyBlock(Block block) setBodyBlock Set this as block as the single block for the message.voidsetDoingSWA(boolean value) Indicate that an SWA DataHandler was added to the message.voidsetHeaderBlock(String namespace, String localPart, Block block) setHeaderBlock replaces the first existing header block with this new block.voidsetIndirection(int indirection) Set indirection.voidsetMessageContext(MessageContext messageContext) JAX-WS Message Context that owns the MessagevoidsetMimeHeaders(Map map) Set the transport headersvoidsetMTOMEnabled(boolean b) A message is MTOM enabled if the associated dispatch/client/impl/provider has a binding type that enables MTOM.voidsetOperationElement(QName operationQName) Set the operation element qname.voidsetParent Set the Message object that will hold this XMLPartvoidIndicate that this message is passed the pivot point.voidsetStyle(jakarta.jws.soap.SOAPBinding.Style style) Set the Style.voidsetXMLFault(XMLFault xmlFault) Change the XMLPart so that it represents the fault described by XMLFaulttraceString(String indent) Get a traceString...the trace string dumps the contents of the Block without forcing an underlying ill-performant transformation of the message.
-
Method Details
-
getAsSOAPMessage
public jakarta.xml.soap.SOAPMessage getAsSOAPMessage() throws jakarta.xml.ws.WebServiceExceptionDescription copied from interface:MessagegetAsSOAPMessage Get the xml part as a read/write SOAPEnvelope- Specified by:
getAsSOAPMessagein interfaceMessage- Returns:
- SOAPEnvelope
- Throws:
jakarta.xml.ws.WebServiceException
-
getAttachmentID
Get the indicated (non-soap part) attachment id- Specified by:
getAttachmentIDin interfaceMessage- Parameters:
index-- Returns:
- CID or null if not present
-
getAttachmentID
Description copied from interface:MessageGet the indicated (non-soap part) attachment id- Specified by:
getAttachmentIDin interfaceMessage- Parameters:
partName- (WS-I indicates that SWA attachments have a partName prefix)- Returns:
- CID or null if not present
-
getValue
public Object getValue(Object context, BlockFactory blockFactory) throws jakarta.xml.ws.WebServiceException -
getAttachmentIDs
Description copied from interface:MessageGet the list of attachment content ids for the message- Specified by:
getAttachmentIDsin interfaceMessage- Returns:
- List
-
getDataHandler
Description copied from interface:MessageGet the attachment identified by the contentID- Specified by:
getDataHandlerin interfaceMessage- Returns:
-
removeDataHandler
Description copied from interface:MessageGet the attachment and remove it from the Message- Specified by:
removeDataHandlerin interfaceMessage
-
getProtocol
Description copied from interface:MessageGet the protocol for this Message (soap11, soap12, etc.)- Specified by:
getProtocolin interfaceMessage- Specified by:
getProtocolin interfaceXMLPart- Returns:
- Protocl
-
getAsOMElement
public org.apache.axiom.om.OMElement getAsOMElement() throws jakarta.xml.ws.WebServiceExceptionDescription copied from interface:XMLPartgetAsOMElement Get the xml part as a read/write OM...note this returns an OM SOAPEnvelope for all protocols...even REST- Specified by:
getAsOMElementin interfaceXMLPart- Returns:
- OMElement
- Throws:
jakarta.xml.ws.WebServiceException
-
getAsSOAPEnvelope
public jakarta.xml.soap.SOAPEnvelope getAsSOAPEnvelope() throws jakarta.xml.ws.WebServiceExceptionDescription copied from interface:XMLPartgetAsEnvelope Get the xml part as a read/write SOAPEnvelope- Specified by:
getAsSOAPEnvelopein interfaceXMLPart- Returns:
- SOAPEnvelope
- Throws:
jakarta.xml.ws.WebServiceException
-
getBodyBlock
public Block getBodyBlock(int index, Object context, BlockFactory blockFactory) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartgetBodyBlock Get the body block at the specificed index. The BlockFactory and object context are passed in to help create the proper kind of block. Calling this method will cache the OM. Avoid it in performant situations.- Specified by:
getBodyBlockin interfaceXMLPart- Returns:
- Block or null
- Throws:
jakarta.xml.ws.WebServiceException- See Also:
-
getHeaderBlock
public Block getHeaderBlock(String namespace, String localPart, Object context, BlockFactory blockFactory) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartgetHeaderBlock Get the firstheader block with the specified name. The BlockFactory and object context are passed in to help create the proper kind of block.- Specified by:
getHeaderBlockin interfaceXMLPart- Returns:
- Block
- Throws:
jakarta.xml.ws.WebServiceException
-
getHeaderBlocks
public List<Block> getHeaderBlocks(String namespace, String localPart, Object context, BlockFactory blockFactory, org.apache.axiom.soap.RolePlayer rolePlayer) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartgetHeaderBlock Get the header blocks with the specified name The BlockFactory and object context are passed in to help create the proper kind of block.- Specified by:
getHeaderBlocksin interfaceXMLPart- Parameters:
namespace- uri of headerlocalPart- local name of headercontext- context for blockFactoryblockFactory- kind of factory (i.e. JAXB)- Returns:
- List
- Throws:
jakarta.xml.ws.WebServiceException
-
getNumBodyBlocks
public int getNumBodyBlocks() throws jakarta.xml.ws.WebServiceExceptionDescription copied from interface:XMLPartgetNumBodyBlocks Calling this method will cache the OM. Avoid it in performant situations.- Specified by:
getNumBodyBlocksin interfaceXMLPart- Returns:
- number of body blocks
- Throws:
jakarta.xml.ws.WebServiceException
-
getBodyBlockQNames
Description copied from interface:XMLPartgetBodyBlockQNames Calling this method will cache the OM. Avoid it in performant situations.- Specified by:
getBodyBlockQNamesin interfaceXMLPart- Returns:
- List of QNames
- Throws:
jakarta.xml.ws.WebServiceException
-
getNumHeaderBlocks
public int getNumHeaderBlocks() throws jakarta.xml.ws.WebServiceExceptionDescription copied from interface:XMLPartgetNumHeaderBlocks- Specified by:
getNumHeaderBlocksin interfaceXMLPart- Returns:
- number of header blocks
- Throws:
jakarta.xml.ws.WebServiceException
-
getXMLStreamReader
public XMLStreamReader getXMLStreamReader(boolean consume) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartGet the XMLStreamReader represented by this Message for the xml part- Specified by:
getXMLStreamReaderin interfaceXMLPart- Parameters:
consume- true if this is the last request on the Message- Returns:
- XMLStreamReader
- Throws:
jakarta.xml.ws.WebServiceException
-
isConsumed
public boolean isConsumed()Description copied from interface:XMLPartisConsumed Return true if the part is consumed. Once consumed, the information in the part is no longer available.- Specified by:
isConsumedin interfaceXMLPart- Returns:
- true if the block is consumed (a method was called with consume=true)
-
outputTo
public void outputTo(XMLStreamWriter writer, boolean consume) throws XMLStreamException, jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartWrite out the Message- Specified by:
outputToin interfaceXMLPart- Parameters:
writer- XMLStreamWriterconsume- true if this is the last request on the block.- Throws:
jakarta.xml.ws.WebServiceExceptionXMLStreamException
-
removeBodyBlock
public void removeBodyBlock(int index) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartremoveBodyBlock Removes the indicated BodyBlock- Specified by:
removeBodyBlockin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
removeHeaderBlock
public void removeHeaderBlock(String namespace, String localPart) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartremoveHeaderBlock Removes all header blocks with this namespace/localpart- Specified by:
removeHeaderBlockin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
setBodyBlock
Description copied from interface:XMLPartsetBodyBlock Set the block at the specified index Once set, the Message owns the block. You must use the getBodyBlock method to access it.- Specified by:
setBodyBlockin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
setHeaderBlock
public void setHeaderBlock(String namespace, String localPart, Block block) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartsetHeaderBlock replaces the first existing header block with this new block. If there is no existing header block, one is added to the end of the headers- Specified by:
setHeaderBlockin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
appendHeaderBlock
public void appendHeaderBlock(String namespace, String localPart, Block block) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartappendHeaderBlock Append the block to the list of header blocks. The Message owns the block. You must use the getHeaderBlock method to access it.- Specified by:
appendHeaderBlockin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
traceString
Description copied from interface:XMLPartGet a traceString...the trace string dumps the contents of the Block without forcing an underlying ill-performant transformation of the message.- Specified by:
traceStringin interfaceXMLPart- Returns:
- String containing trace information
-
addDataHandler
Description copied from interface:MessageAdd Attachment- Specified by:
addDataHandlerin interfaceMessage- Parameters:
dh- DataHandler (type of Attachment is inferred from dh.getContentType)id- String which is the Attachment content id- See Also:
-
addAttachment(Attachment)
-
getParent
Description copied from interface:XMLPartgetParent Get the Message object that this XMLPart is attached to, if it is attached to one at all. -
setParent
Description copied from interface:XMLPartsetParent Set the Message object that will hold this XMLPart -
isMTOMEnabled
public boolean isMTOMEnabled()Description copied from interface:MessageA message is MTOM enabled if the associated dispatch/client/impl/provider has a binding type that enables MTOM.- Specified by:
isMTOMEnabledin interfaceMessage- Returns:
- true if the binding for this message indicates mtom
-
setMTOMEnabled
public void setMTOMEnabled(boolean b) Description copied from interface:MessageA message is MTOM enabled if the associated dispatch/client/impl/provider has a binding type that enables MTOM. Indicate whether this is an MTOM message- Specified by:
setMTOMEnabledin interfaceMessage- Parameters:
true- if the binding for this message indicates mtom
-
getXMLFault
Description copied from interface:XMLPartIf the XMLPart represents a fault, an XMLFault is returned which describes the fault in a protocol agnostic manner- Specified by:
getXMLFaultin interfaceXMLPart- Returns:
- the XMLFault object or null
- Throws:
jakarta.xml.ws.WebServiceException- See Also:
-
setXMLFault
Description copied from interface:XMLPartChange the XMLPart so that it represents the fault described by XMLFault- Specified by:
setXMLFaultin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException- See Also:
-
isFault
public boolean isFault() throws jakarta.xml.ws.WebServiceExceptionDescription copied from interface:XMLPartDetermines whether the XMLPart represents a Fault -
getXMLPartContentType
Description copied from interface:XMLPartThe representation of the XMLPart may be in a number of different forms. Currently the forms are UNKNOWN, OM, SOAPENVELOPE, and SPINE. This method returns a String containing one of these types. This method should only be used for trace and testing purposes. The consumer of a Message should not make any decisions based on the representation of the XMLPart- Specified by:
getXMLPartContentTypein interfaceXMLPart- Returns:
- String
-
getStyle
public jakarta.jws.soap.SOAPBinding.Style getStyle() -
setStyle
public void setStyle(jakarta.jws.soap.SOAPBinding.Style style) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartSet the Style. If the style is DOCUMENT, the body blocks are located underneath the body element. If the style is set to RPC, then the body blocks are located underneath the rpc operation. -
getOperationElement
- Specified by:
getOperationElementin interfaceXMLPart- Returns:
- the QName of the operation element if Style.rpc. Otherwise null
- Throws:
jakarta.xml.ws.WebServiceException
-
setOperationElement
Description copied from interface:XMLPartSet the operation element qname. The operation qname is only used if Style.rpc- Specified by:
setOperationElementin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
getMimeHeaders
- Specified by:
getMimeHeadersin interfaceMessage- Returns:
- get the transport headers map.
-
setMimeHeaders
Description copied from interface:MessageSet the transport headers- Specified by:
setMimeHeadersin interfaceMessage- Parameters:
map- Map
-
getBodyBlock
public Block getBodyBlock(Object context, BlockFactory blockFactory) throws jakarta.xml.ws.WebServiceException Description copied from interface:XMLPartgetBodyBlock Get the single Body Block. The BlockFactory and object context are passed in to help create the proper kind of block. This method should only be invoked when it is known that there is zero or one block.- Specified by:
getBodyBlockin interfaceXMLPart- Returns:
- Block or null
- Throws:
jakarta.xml.ws.WebServiceException
-
setBodyBlock
Description copied from interface:XMLPartsetBodyBlock Set this as block as the single block for the message.- Specified by:
setBodyBlockin interfaceXMLPart- Throws:
jakarta.xml.ws.WebServiceException
-
setPostPivot
public void setPostPivot()Description copied from interface:MessageIndicate that this message is passed the pivot point. For example, this is set in the JAX-WS Dispatcher to indicate- Specified by:
setPostPivotin interfaceMessage
-
isPostPivot
public boolean isPostPivot()- Specified by:
isPostPivotin interfaceMessage- Returns:
- true if post pivot
-
getIndirection
public int getIndirection()Description copied from interface:XMLPartGet indirection. Used to force the code to look for blocks at a particular location. For DOCUMENT the default is 0 For RPC the default is 1 This method is used to override these settings for special cases.- Specified by:
getIndirectionin interfaceXMLPart- Returns:
- indirection (0 or 1)
-
setIndirection
public void setIndirection(int indirection) Description copied from interface:XMLPartSet indirection. Used to force the code to look for blocks at a particular location. For DOCUMENT the default is 0 For RPC the default is 1 This method is used to override these settings for special cases.- Specified by:
setIndirectionin interfaceXMLPart- Parameters:
indirection- (0 or 1)
-
getMessageContext
- Specified by:
getMessageContextin interfaceMessage- Returns:
- JAX-WS MessageContext
-
setMessageContext
Description copied from interface:MessageJAX-WS Message Context that owns the Message- Specified by:
setMessageContextin interfaceMessage
-
setDoingSWA
public void setDoingSWA(boolean value) Description copied from interface:MessageIndicate that an SWA DataHandler was added to the message. This information will be used to trigger SWA serialization.- Specified by:
setDoingSWAin interfaceMessage
-
isDoingSWA
public boolean isDoingSWA()- Specified by:
isDoingSWAin interfaceMessage- Returns:
- true if SWA DataHandler is present
-
close
public void close()Description copied from interface:XMLPartUsed primarily to ensure the parser is forwarded to the end so it can be closed. -
getHeaderQNames
- Specified by:
getHeaderQNamesin interfaceXMLPart- Returns:
- QNames of headers
-