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 Stringproperty used to set SOAPEnvelope as default formstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected static org.apache.commons.logging.Logprotected DocumentSOAPEnvelope 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 TypeMethodDescriptionvoidaddMimeHeader(String header, String value) Add the specified MIME header, as per JAXM.appendChild(Node newChild) cloneNode(boolean deep) shortcompareDocumentPosition(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 thisSOAPPartobject as an iterator over theMimeHeaderobjects.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 JAXPSourceobject.Content ID.Content ID.longGet the content length for this SOAPPart.Content location.Content type is always "text/xml" for SOAPParts.intGet the current message, in whatever form it happens to be right now.getElementById(String elementId) getElementsByTagName(String tagname) getElementsByTagNameNS(String namespaceURI, String localName) Gets theSOAPEnvelopeobject associated with thisSOAPPartobject.getFeature(String feature, String version) getMatchingMimeHeaders(String[] match) Get all headers that match.Get theMessagefor thisPart.String[]getMimeHeader(String name) Gets all the values of theMimeHeaderobject in thisSOAPPartobject that is identified by the givenString.Node ImplementationshortgetNonMatchingMimeHeaders(String[] match) Get all headers that do not match.booleanbooleangetUserData(String key) booleanbooleanbooleanimportNode(Node importedNode, boolean deep) insertBefore(Node newChild, Node refChild) booleanbooleanisDefaultNamespace(String namespaceURI) booleanisEqualNode(Node arg) booleanisSameNode(Node other) booleanisSupported(String feature, String version) lookupNamespaceURI(String prefix) lookupPrefix(String namespaceURI) voidvoidvoidRemoves all theMimeHeaderobjects for thisSOAPEnvelopeobject.removeChild(Node oldChild) voidremoveMimeHeader(String header) Removes all MIME headers that match the given name.renameNode(Node n, String namespaceURI, String qualifiedName) replaceChild(Node newChild, Node oldChild) voidvoidsetContent(Source source) Sets the content of theSOAPEnvelopeobject with the data from the givenSourceobject.voidsetContentId(String newCid) Sets Content-Id of this part.voidsetContentLocation(String loc) Set content location.voidsetCurrentMessage(Object currMsg, int form) Set the current messagevoidsetDocumentURI(String documentURI) voidvoidsetMessage(Message msg) Set the Message for this Part.voidsetMimeHeader(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.voidsetNodeValue(String nodeValue) voidvoidThis set the SOAP Envelope for this part.voidsetStandalone(boolean flag) voidsetStrictErrorChecking(boolean flag) voidsetTextContent(String textContent) setUserData(String key, Object data, UserDataHandler handler) voidsetVersion(String s) voidsetXmlStandalone(boolean xmlStandalone) voidsetXmlVersion(String xmlVersion) voidwriteTo(OutputStream os) Write the contents to the specified stream.voidWrite 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 parentMessageinitialContents- the initial contensObjectisBodyStream- if the body is in a stream
-
-
Method Details
-
getMessage
Get theMessagefor thisPart.- Returns:
- the
Messagefor thisPart
-
setMessage
Set the Message for this Part. Do not call this Directly. Called by Message.- Parameters:
msg- theMessagefor this part
-
getContentType
Content type is always "text/xml" for SOAPParts.- Specified by:
getContentTypein 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- theSOAPEnvelopefor thisSOAPPart
-
writeTo
Write the contents to the specified stream.- Parameters:
os- thejava.io.OutputStreamto write to- Throws:
IOException
-
writeTo
Write the contents to the specified writer.- Parameters:
writer- theWriterto 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
Stringcontaining 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
SOAPEnvelopecontaining the message content - Throws:
AxisFault- if the envelope could not be constructed
-
addMimeHeader
Add the specified MIME header, as per JAXM.- Specified by:
addMimeHeaderin interfacePart- Specified by:
addMimeHeaderin classSOAPPart- Parameters:
header- the header to addvalue- the value of that header
-
getContentLocation
Content location.- Specified by:
getContentLocationin interfacePart- Overrides:
getContentLocationin classSOAPPart- Returns:
- the content location
- See Also:
-
setContentLocation
Set content location.- Specified by:
setContentLocationin interfacePart- Overrides:
setContentLocationin classSOAPPart- Parameters:
loc- the content location- See Also:
-
setContentId
Sets Content-Id of this part. already defined.- Specified by:
setContentIdin interfacePart- Overrides:
setContentIdin classSOAPPart- Parameters:
newCid- new Content-Id- See Also:
-
getContentId
Content ID.- Specified by:
getContentIdin interfacePart- Overrides:
getContentIdin classSOAPPart- Returns:
- the content ID
- See Also:
-
getContentIdRef
Content ID.- Specified by:
getContentIdRefin 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:
getMatchingMimeHeadersin interfacePart- Specified by:
getMatchingMimeHeadersin classSOAPPart- Parameters:
match- an array ofStrings giving mime header names- Returns:
- an
Iteratorover all values matching these headers
-
getNonMatchingMimeHeaders
Get all headers that do not match.- Specified by:
getNonMatchingMimeHeadersin interfacePart- Specified by:
getNonMatchingMimeHeadersin classSOAPPart- Parameters:
match- an array ofStrings giving mime header names- Returns:
- an
Iteratorover all values not matching these headers
-
setContent
Sets the content of theSOAPEnvelopeobject with the data from the givenSourceobject.- Specified by:
setContentin 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 JAXPSourceobject.- Specified by:
getContentin classSOAPPart- Returns:
- the content as a
javax.xml.transform.Sourceobject - Throws:
SOAPException- if the implementation cannot convert the specifiedSourceobject- See Also:
-
getAllMimeHeaders
Retrieves all the headers for thisSOAPPartobject as an iterator over theMimeHeaderobjects.- Specified by:
getAllMimeHeadersin classSOAPPart- Returns:
- an
Iteratorobject with all of the Mime headers for thisSOAPPartobject
-
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:
setMimeHeaderin classSOAPPart- Parameters:
name- aStringgiving the header name for which to searchvalue- aStringgiving 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 newMimeHeaderobject.- See Also:
-
getMimeHeader
Gets all the values of theMimeHeaderobject in thisSOAPPartobject that is identified by the givenString.- Specified by:
getMimeHeaderin interfacePart- Specified by:
getMimeHeaderin classSOAPPart- Parameters:
name- the name of the header; example: "Content-Type"- Returns:
- a
Stringarray giving all the values for the specified header - See Also:
-
removeAllMimeHeaders
public void removeAllMimeHeaders()Removes all theMimeHeaderobjects for thisSOAPEnvelopeobject.- Specified by:
removeAllMimeHeadersin classSOAPPart
-
removeMimeHeader
Removes all MIME headers that match the given name.- Specified by:
removeMimeHeaderin classSOAPPart- Parameters:
header- aStringgiving the name of the MIME header(s) to be removed
-
getEnvelope
Gets theSOAPEnvelopeobject associated with thisSOAPPartobject. Once the SOAP envelope is obtained, it can be used to get its contents.- Specified by:
getEnvelopein classSOAPPart- Returns:
- the
SOAPEnvelopeobject for thisSOAPPartobject - Throws:
SOAPException- if there is a SOAP error
-
getSOAPDocument
- Since:
- SAAJ 1.2
-
getDoctype
- Specified by:
getDoctypein interfaceDocument- Returns:
-
getImplementation
- Specified by:
getImplementationin interfaceDocument- Returns:
-
getDocumentElement
- Specified by:
getDocumentElementin interfaceDocument
-
createElement
- Specified by:
createElementin interfaceDocument- Parameters:
tagName-- Returns:
- Throws:
DOMException
-
createDocumentFragment
- Specified by:
createDocumentFragmentin interfaceDocument
-
createTextNode
- Specified by:
createTextNodein interfaceDocument
-
createComment
- Specified by:
createCommentin interfaceDocument
-
createCDATASection
- Specified by:
createCDATASectionin interfaceDocument- Throws:
DOMException
-
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException - Specified by:
createProcessingInstructionin interfaceDocument- Throws:
DOMException
-
createAttribute
- Specified by:
createAttributein interfaceDocument- Throws:
DOMException
-
createEntityReference
- Specified by:
createEntityReferencein interfaceDocument- Throws:
DOMException
-
getElementsByTagName
- Specified by:
getElementsByTagNamein interfaceDocument
-
importNode
- Specified by:
importNodein interfaceDocument- Throws:
DOMException
-
createElementNS
- Specified by:
createElementNSin interfaceDocument- Throws:
DOMException
-
createAttributeNS
- Specified by:
createAttributeNSin interfaceDocument- Throws:
DOMException
-
getElementsByTagNameNS
- Specified by:
getElementsByTagNameNSin interfaceDocument
-
getElementById
- Specified by:
getElementByIdin interfaceDocument
-
getEncoding
-
setEncoding
-
getStandalone
public boolean getStandalone() -
setStandalone
public void setStandalone(boolean flag) -
getStrictErrorChecking
public boolean getStrictErrorChecking()- Specified by:
getStrictErrorCheckingin interfaceDocument
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean flag) - Specified by:
setStrictErrorCheckingin interfaceDocument
-
getVersion
-
setVersion
-
adoptNode
- Specified by:
adoptNodein interfaceDocument- Throws:
DOMException
-
getNodeName
Node Implementation- Specified by:
getNodeNamein interfaceNode
-
getNodeValue
- Specified by:
getNodeValuein interfaceNode- Throws:
DOMException
-
setNodeValue
- Specified by:
setNodeValuein interfaceNode- Throws:
DOMException
-
getNodeType
public short getNodeType()- Specified by:
getNodeTypein interfaceNode
-
getParentNode
- Specified by:
getParentNodein interfaceNode
-
getChildNodes
- Specified by:
getChildNodesin interfaceNode
-
getFirstChild
- Specified by:
getFirstChildin interfaceNode
-
getLastChild
- Specified by:
getLastChildin interfaceNode
-
getPreviousSibling
- Specified by:
getPreviousSiblingin interfaceNode
-
getNextSibling
- Specified by:
getNextSiblingin interfaceNode
-
getAttributes
- Specified by:
getAttributesin interfaceNode
-
getOwnerDocument
- Specified by:
getOwnerDocumentin interfaceNode
-
insertBefore
- Specified by:
insertBeforein interfaceNode- Throws:
DOMException
-
replaceChild
- Specified by:
replaceChildin interfaceNode- Throws:
DOMException
-
removeChild
- Specified by:
removeChildin interfaceNode- Throws:
DOMException
-
appendChild
- Specified by:
appendChildin interfaceNode- Throws:
DOMException
-
hasChildNodes
public boolean hasChildNodes()- Specified by:
hasChildNodesin interfaceNode
-
cloneNode
-
normalize
public void normalize() -
isSupported
- Specified by:
isSupportedin interfaceNode
-
getNamespaceURI
- Specified by:
getNamespaceURIin interfaceNode
-
getPrefix
-
setPrefix
- Specified by:
setPrefixin interfaceNode- Throws:
DOMException
-
getLocalName
- Specified by:
getLocalNamein interfaceNode
-
hasAttributes
public boolean hasAttributes()- Specified by:
hasAttributesin interfaceNode
-
isBodyStream
public boolean isBodyStream() -
getBaseURI
DOM Level 3 stubs- Specified by:
getBaseURIin interfaceNode
-
getXmlStandalone
public boolean getXmlStandalone()- Specified by:
getXmlStandalonein interfaceDocument
-
setUserData
- Specified by:
setUserDatain interfaceNode
-
setDocumentURI
- Specified by:
setDocumentURIin interfaceDocument
-
setXmlStandalone
public void setXmlStandalone(boolean xmlStandalone) - Specified by:
setXmlStandalonein interfaceDocument
-
renameNode
- Specified by:
renameNodein interfaceDocument
-
getInputEncoding
- Specified by:
getInputEncodingin interfaceDocument
-
getXmlEncoding
- Specified by:
getXmlEncodingin interfaceDocument
-
setTextContent
- Specified by:
setTextContentin interfaceNode
-
isSameNode
- Specified by:
isSameNodein interfaceNode
-
getDocumentURI
- Specified by:
getDocumentURIin interfaceDocument
-
getFeature
- Specified by:
getFeaturein interfaceNode
-
isDefaultNamespace
- Specified by:
isDefaultNamespacein interfaceNode
-
lookupPrefix
- Specified by:
lookupPrefixin interfaceNode
-
isEqualNode
- Specified by:
isEqualNodein interfaceNode
-
setXmlVersion
- Specified by:
setXmlVersionin interfaceDocument
-
getXmlVersion
- Specified by:
getXmlVersionin interfaceDocument
-
getUserData
- Specified by:
getUserDatain interfaceNode
-
getTextContent
- Specified by:
getTextContentin interfaceNode
-
normalizeDocument
public void normalizeDocument()- Specified by:
normalizeDocumentin interfaceDocument
-
lookupNamespaceURI
- Specified by:
lookupNamespaceURIin interfaceNode
-
getDomConfig
- Specified by:
getDomConfigin interfaceDocument
-
compareDocumentPosition
- Specified by:
compareDocumentPositionin interfaceNode
-