Class SOAPPart
- All Implemented Interfaces:
Serializable
,Part
,Document
,Node
SOAPPart implements Part, providing common MIME operations.
SOAPPart also allows access to its envelope, as a string, byte[], InputStream, or SOAPEnvelope. (This functionality used to be in Message, and has been moved here more or less verbatim pending further cleanup.)
- Author:
- Rob Jellinghaus (robj@unrealities.com), Doug Davis (dug@us.ibm.com), Glen Daniels (gdaniels@allaire.com), Heejune Ahn (cityboy@tmax.co.kr)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
property used to set SOAPEnvelope as default formstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
protected static org.apache.commons.logging.Log
protected Document
SOAPEnvelope is the Document Elements of this XML docuementFields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMimeHeader
(String header, String value) Add the specified MIME header, as per JAXM.appendChild
(Node newChild) cloneNode
(boolean deep) short
compareDocumentPosition
(Node other) createAttribute
(String name) createAttributeNS
(String namespaceURI, String qualifiedName) createCDATASection
(String data) createComment
(String data) createElement
(String tagName) createElementNS
(String namespaceURI, String qualifiedName) createEntityReference
(String name) createProcessingInstruction
(String target, String data) createTextNode
(String data) Retrieves all the headers for thisSOAPPart
object as an iterator over theMimeHeader
objects.byte[]
Get the contents of this Part (not the headers!), as a byte array.Get the contents of this Part (not the MIME headers!), as a SOAPEnvelope.Get the contents of this Part (not the headers!), as a String.DOM Level 3 stubsReturns the content of the SOAPEnvelope as a JAXPSource
object.Content ID.Content ID.long
Get the content length for this SOAPPart.Content location.Content type is always "text/xml" for SOAPParts.int
Get the current message, in whatever form it happens to be right now.getElementById
(String elementId) getElementsByTagName
(String tagname) getElementsByTagNameNS
(String namespaceURI, String localName) Gets theSOAPEnvelope
object associated with thisSOAPPart
object.getFeature
(String feature, String version) getMatchingMimeHeaders
(String[] match) Get all headers that match.Get theMessage
for thisPart
.String[]
getMimeHeader
(String name) Gets all the values of theMimeHeader
object in thisSOAPPart
object that is identified by the givenString
.Node Implementationshort
getNonMatchingMimeHeaders
(String[] match) Get all headers that do not match.boolean
boolean
getUserData
(String key) boolean
boolean
boolean
importNode
(Node importedNode, boolean deep) insertBefore
(Node newChild, Node refChild) boolean
boolean
isDefaultNamespace
(String namespaceURI) boolean
isEqualNode
(Node arg) boolean
isSameNode
(Node other) boolean
isSupported
(String feature, String version) lookupNamespaceURI
(String prefix) lookupPrefix
(String namespaceURI) void
void
void
Removes all theMimeHeader
objects for thisSOAPEnvelope
object.removeChild
(Node oldChild) void
removeMimeHeader
(String header) Removes all MIME headers that match the given name.renameNode
(Node n, String namespaceURI, String qualifiedName) replaceChild
(Node newChild, Node oldChild) void
void
setContent
(Source source) Sets the content of theSOAPEnvelope
object with the data from the givenSource
object.void
setContentId
(String newCid) Sets Content-Id of this part.void
setContentLocation
(String loc) Set content location.void
setCurrentMessage
(Object currMsg, int form) Set the current messagevoid
setDocumentURI
(String documentURI) void
void
setMessage
(Message msg) Set the Message for this Part.void
setMimeHeader
(String name, String value) Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match.void
setNodeValue
(String nodeValue) void
void
This set the SOAP Envelope for this part.void
setStandalone
(boolean flag) void
setStrictErrorChecking
(boolean flag) void
setTextContent
(String textContent) setUserData
(String key, Object data, UserDataHandler handler) void
setVersion
(String s) void
setXmlStandalone
(boolean xmlStandalone) void
setXmlVersion
(String xmlVersion) void
writeTo
(OutputStream os) Write the contents to the specified stream.void
Write the contents to the specified writer.
-
Field Details
-
log
protected static org.apache.commons.logging.Log log -
FORM_STRING
public static final int FORM_STRING- See Also:
-
FORM_INPUTSTREAM
public static final int FORM_INPUTSTREAM- See Also:
-
FORM_SOAPENVELOPE
public static final int FORM_SOAPENVELOPE- See Also:
-
FORM_BYTES
public static final int FORM_BYTES- See Also:
-
FORM_BODYINSTREAM
public static final int FORM_BODYINSTREAM- See Also:
-
FORM_FAULT
public static final int FORM_FAULT- See Also:
-
FORM_OPTIMIZED
public static final int FORM_OPTIMIZED- See Also:
-
ALLOW_FORM_OPTIMIZATION
property used to set SOAPEnvelope as default form- See Also:
-
mDocument
SOAPEnvelope is the Document Elements of this XML docuement
-
-
Constructor Details
-
SOAPPart
Create a new SOAPPart.Do not call this directly! Should only be called by Message.
- Parameters:
parent
- the parentMessage
initialContents
- the initial contensObject
isBodyStream
- if the body is in a stream
-
-
Method Details
-
getMessage
Get theMessage
for thisPart
.- Returns:
- the
Message
for thisPart
-
setMessage
Set the Message for this Part. Do not call this Directly. Called by Message.- Parameters:
msg
- theMessage
for this part
-
getContentType
Content type is always "text/xml" for SOAPParts.- Specified by:
getContentType
in interfacePart
- Returns:
- the content type
-
getContentLength
Get the content length for this SOAPPart. This will force buffering of the SOAPPart, but it will also cache the byte[] form of the SOAPPart.- Returns:
- the content length in bytes
- Throws:
AxisFault
-
setSOAPEnvelope
This set the SOAP Envelope for this part.Note: It breaks the chicken/egg created. I need a message to create an attachment... From the attachment I should be able to get a reference... I now want to edit elements in the envelope in order to place the attachment reference to it. How do I now update the SOAP envelope with what I've changed?
- Parameters:
env
- theSOAPEnvelope
for thisSOAPPart
-
writeTo
Write the contents to the specified stream.- Parameters:
os
- thejava.io.OutputStream
to write to- Throws:
IOException
-
writeTo
Write the contents to the specified writer.- Parameters:
writer
- theWriter
to write to- Throws:
IOException
-
getCurrentMessage
Get the current message, in whatever form it happens to be right now. Will return a String, byte[], InputStream, or SOAPEnvelope, depending on circumstances.The method name is historical. TODO: rename this for clarity; should be more like getContents.
- Returns:
- the current content
-
setCurrentMessage
Set the current message- Parameters:
currMsg
-form
-
-
getCurrentForm
public int getCurrentForm() -
getAsBytes
Get the contents of this Part (not the headers!), as a byte array. This will force buffering of the message.- Returns:
- an array of bytes containing a byte representation of this Part
- Throws:
AxisFault
- if this Part can't be serialized to the byte array
-
saveChanges
- Throws:
AxisFault
-
getAsString
Get the contents of this Part (not the headers!), as a String. This will force buffering of the message.- Returns:
- a
String
containing the content of this message - Throws:
AxisFault
- if there is an error serializing this part
-
getAsSOAPEnvelope
Get the contents of this Part (not the MIME headers!), as a SOAPEnvelope. This will force a complete parse of the message.- Returns:
- a
SOAPEnvelope
containing the message content - Throws:
AxisFault
- if the envelope could not be constructed
-
addMimeHeader
Add the specified MIME header, as per JAXM.- Specified by:
addMimeHeader
in interfacePart
- Specified by:
addMimeHeader
in classSOAPPart
- Parameters:
header
- the header to addvalue
- the value of that header
-
getContentLocation
Content location.- Specified by:
getContentLocation
in interfacePart
- Overrides:
getContentLocation
in classSOAPPart
- Returns:
- the content location
- See Also:
-
setContentLocation
Set content location.- Specified by:
setContentLocation
in interfacePart
- Overrides:
setContentLocation
in classSOAPPart
- Parameters:
loc
- the content location- See Also:
-
setContentId
Sets Content-Id of this part. already defined.- Specified by:
setContentId
in interfacePart
- Overrides:
setContentId
in classSOAPPart
- Parameters:
newCid
- new Content-Id- See Also:
-
getContentId
Content ID.- Specified by:
getContentId
in interfacePart
- Overrides:
getContentId
in classSOAPPart
- Returns:
- the content ID
- See Also:
-
getContentIdRef
Content ID.- Specified by:
getContentIdRef
in interfacePart
- Returns:
- the contentId reference value that should be used directly as an href in a SOAP element to reference this attachment. Not part of JAX-RPC, JAX-M, SAAJ, etc.
-
getMatchingMimeHeaders
Get all headers that match.- Specified by:
getMatchingMimeHeaders
in interfacePart
- Specified by:
getMatchingMimeHeaders
in classSOAPPart
- Parameters:
match
- an array ofString
s giving mime header names- Returns:
- an
Iterator
over all values matching these headers
-
getNonMatchingMimeHeaders
Get all headers that do not match.- Specified by:
getNonMatchingMimeHeaders
in interfacePart
- Specified by:
getNonMatchingMimeHeaders
in classSOAPPart
- Parameters:
match
- an array ofString
s giving mime header names- Returns:
- an
Iterator
over all values not matching these headers
-
setContent
Sets the content of theSOAPEnvelope
object with the data from the givenSource
object.- Specified by:
setContent
in classSOAPPart
- Parameters:
source
- javax.xml.transform.Source object with the data to be set- Throws:
SOAPException
- if there is a problem in setting the source- See Also:
-
getContent
Returns the content of the SOAPEnvelope as a JAXPSource
object.- Specified by:
getContent
in classSOAPPart
- Returns:
- the content as a
javax.xml.transform.Source
object - Throws:
SOAPException
- if the implementation cannot convert the specifiedSource
object- See Also:
-
getAllMimeHeaders
Retrieves all the headers for thisSOAPPart
object as an iterator over theMimeHeader
objects.- Specified by:
getAllMimeHeaders
in classSOAPPart
- Returns:
- an
Iterator
object with all of the Mime headers for thisSOAPPart
object
-
setMimeHeader
Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match. If there is a match, this method clears all existing values for the first header that matches and sets the given value instead. If more than one header has the given name, this method removes all of the matching headers after the first one.Note that RFC822 headers can contain only US-ASCII characters.
- Specified by:
setMimeHeader
in classSOAPPart
- Parameters:
name
- aString
giving the header name for which to searchvalue
- aString
giving the value to be set. This value will be substituted for the current value(s) of the first header that is a match if there is one. If there is no match, this value will be the value for a newMimeHeader
object.- See Also:
-
getMimeHeader
Gets all the values of theMimeHeader
object in thisSOAPPart
object that is identified by the givenString
.- Specified by:
getMimeHeader
in interfacePart
- Specified by:
getMimeHeader
in classSOAPPart
- Parameters:
name
- the name of the header; example: "Content-Type"- Returns:
- a
String
array giving all the values for the specified header - See Also:
-
removeAllMimeHeaders
public void removeAllMimeHeaders()Removes all theMimeHeader
objects for thisSOAPEnvelope
object.- Specified by:
removeAllMimeHeaders
in classSOAPPart
-
removeMimeHeader
Removes all MIME headers that match the given name.- Specified by:
removeMimeHeader
in classSOAPPart
- Parameters:
header
- aString
giving the name of the MIME header(s) to be removed
-
getEnvelope
Gets theSOAPEnvelope
object associated with thisSOAPPart
object. Once the SOAP envelope is obtained, it can be used to get its contents.- Specified by:
getEnvelope
in classSOAPPart
- Returns:
- the
SOAPEnvelope
object for thisSOAPPart
object - Throws:
SOAPException
- if there is a SOAP error
-
getSOAPDocument
- Since:
- SAAJ 1.2
-
getDoctype
- Specified by:
getDoctype
in interfaceDocument
- Returns:
-
getImplementation
- Specified by:
getImplementation
in interfaceDocument
- Returns:
-
getDocumentElement
- Specified by:
getDocumentElement
in interfaceDocument
-
createElement
- Specified by:
createElement
in interfaceDocument
- Parameters:
tagName
-- Returns:
- Throws:
DOMException
-
createDocumentFragment
- Specified by:
createDocumentFragment
in interfaceDocument
-
createTextNode
- Specified by:
createTextNode
in interfaceDocument
-
createComment
- Specified by:
createComment
in interfaceDocument
-
createCDATASection
- Specified by:
createCDATASection
in interfaceDocument
- Throws:
DOMException
-
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException - Specified by:
createProcessingInstruction
in interfaceDocument
- Throws:
DOMException
-
createAttribute
- Specified by:
createAttribute
in interfaceDocument
- Throws:
DOMException
-
createEntityReference
- Specified by:
createEntityReference
in interfaceDocument
- Throws:
DOMException
-
getElementsByTagName
- Specified by:
getElementsByTagName
in interfaceDocument
-
importNode
- Specified by:
importNode
in interfaceDocument
- Throws:
DOMException
-
createElementNS
- Specified by:
createElementNS
in interfaceDocument
- Throws:
DOMException
-
createAttributeNS
- Specified by:
createAttributeNS
in interfaceDocument
- Throws:
DOMException
-
getElementsByTagNameNS
- Specified by:
getElementsByTagNameNS
in interfaceDocument
-
getElementById
- Specified by:
getElementById
in interfaceDocument
-
getEncoding
-
setEncoding
-
getStandalone
public boolean getStandalone() -
setStandalone
public void setStandalone(boolean flag) -
getStrictErrorChecking
public boolean getStrictErrorChecking()- Specified by:
getStrictErrorChecking
in interfaceDocument
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean flag) - Specified by:
setStrictErrorChecking
in interfaceDocument
-
getVersion
-
setVersion
-
adoptNode
- Specified by:
adoptNode
in interfaceDocument
- Throws:
DOMException
-
getNodeName
Node Implementation- Specified by:
getNodeName
in interfaceNode
-
getNodeValue
- Specified by:
getNodeValue
in interfaceNode
- Throws:
DOMException
-
setNodeValue
- Specified by:
setNodeValue
in interfaceNode
- Throws:
DOMException
-
getNodeType
public short getNodeType()- Specified by:
getNodeType
in interfaceNode
-
getParentNode
- Specified by:
getParentNode
in interfaceNode
-
getChildNodes
- Specified by:
getChildNodes
in interfaceNode
-
getFirstChild
- Specified by:
getFirstChild
in interfaceNode
-
getLastChild
- Specified by:
getLastChild
in interfaceNode
-
getPreviousSibling
- Specified by:
getPreviousSibling
in interfaceNode
-
getNextSibling
- Specified by:
getNextSibling
in interfaceNode
-
getAttributes
- Specified by:
getAttributes
in interfaceNode
-
getOwnerDocument
- Specified by:
getOwnerDocument
in interfaceNode
-
insertBefore
- Specified by:
insertBefore
in interfaceNode
- Throws:
DOMException
-
replaceChild
- Specified by:
replaceChild
in interfaceNode
- Throws:
DOMException
-
removeChild
- Specified by:
removeChild
in interfaceNode
- Throws:
DOMException
-
appendChild
- Specified by:
appendChild
in interfaceNode
- Throws:
DOMException
-
hasChildNodes
public boolean hasChildNodes()- Specified by:
hasChildNodes
in interfaceNode
-
cloneNode
-
normalize
public void normalize() -
isSupported
- Specified by:
isSupported
in interfaceNode
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceNode
-
getPrefix
-
setPrefix
- Specified by:
setPrefix
in interfaceNode
- Throws:
DOMException
-
getLocalName
- Specified by:
getLocalName
in interfaceNode
-
hasAttributes
public boolean hasAttributes()- Specified by:
hasAttributes
in interfaceNode
-
isBodyStream
public boolean isBodyStream() -
getBaseURI
DOM Level 3 stubs- Specified by:
getBaseURI
in interfaceNode
-
getXmlStandalone
public boolean getXmlStandalone()- Specified by:
getXmlStandalone
in interfaceDocument
-
setUserData
- Specified by:
setUserData
in interfaceNode
-
setDocumentURI
- Specified by:
setDocumentURI
in interfaceDocument
-
setXmlStandalone
public void setXmlStandalone(boolean xmlStandalone) - Specified by:
setXmlStandalone
in interfaceDocument
-
renameNode
- Specified by:
renameNode
in interfaceDocument
-
getInputEncoding
- Specified by:
getInputEncoding
in interfaceDocument
-
getXmlEncoding
- Specified by:
getXmlEncoding
in interfaceDocument
-
setTextContent
- Specified by:
setTextContent
in interfaceNode
-
isSameNode
- Specified by:
isSameNode
in interfaceNode
-
getDocumentURI
- Specified by:
getDocumentURI
in interfaceDocument
-
getFeature
- Specified by:
getFeature
in interfaceNode
-
isDefaultNamespace
- Specified by:
isDefaultNamespace
in interfaceNode
-
lookupPrefix
- Specified by:
lookupPrefix
in interfaceNode
-
isEqualNode
- Specified by:
isEqualNode
in interfaceNode
-
setXmlVersion
- Specified by:
setXmlVersion
in interfaceDocument
-
getXmlVersion
- Specified by:
getXmlVersion
in interfaceDocument
-
getUserData
- Specified by:
getUserData
in interfaceNode
-
getTextContent
- Specified by:
getTextContent
in interfaceNode
-
normalizeDocument
public void normalizeDocument()- Specified by:
normalizeDocument
in interfaceDocument
-
lookupNamespaceURI
- Specified by:
lookupNamespaceURI
in interfaceNode
-
getDomConfig
- Specified by:
getDomConfig
in interfaceDocument
-
compareDocumentPosition
- Specified by:
compareDocumentPosition
in interfaceNode
-