public class SOAPPart extends SOAPPart implements Part
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.)
| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOW_FORM_OPTIMIZATION
property used to set SOAPEnvelope as default form
|
static int |
FORM_BODYINSTREAM |
static int |
FORM_BYTES |
static int |
FORM_FAULT |
static int |
FORM_INPUTSTREAM |
static int |
FORM_OPTIMIZED |
static int |
FORM_SOAPENVELOPE |
static int |
FORM_STRING |
protected static org.apache.commons.logging.Log |
log |
protected Document |
mDocument
SOAPEnvelope is the Document Elements of this XML docuement
|
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 and Description |
|---|
SOAPPart(Message parent,
Object initialContents,
boolean isBodyStream)
Create a new SOAPPart.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMimeHeader(String header,
String value)
Add the specified MIME header, as per JAXM.
|
Node |
adoptNode(Node node) |
Node |
appendChild(Node newChild) |
Node |
cloneNode(boolean deep) |
Attr |
createAttribute(String name) |
Attr |
createAttributeNS(String namespaceURI,
String qualifiedName) |
CDATASection |
createCDATASection(String data) |
Comment |
createComment(String data) |
DocumentFragment |
createDocumentFragment() |
Element |
createElement(String tagName) |
Element |
createElementNS(String namespaceURI,
String qualifiedName) |
EntityReference |
createEntityReference(String name) |
ProcessingInstruction |
createProcessingInstruction(String target,
String data) |
Text |
createTextNode(String data) |
Iterator |
getAllMimeHeaders()
Retrieves all the headers for this
SOAPPart
object as an iterator over the MimeHeader
objects. |
byte[] |
getAsBytes()
Get the contents of this Part (not the headers!)
|
SOAPEnvelope |
getAsSOAPEnvelope()
Get the contents of this Part (not the MIME headers!)
|
String |
getAsString()
Get the contents of this Part (not the headers!)
|
NamedNodeMap |
getAttributes() |
NodeList |
getChildNodes() |
Source |
getContent()
Returns the content of the SOAPEnvelope as a JAXP
Source object. |
String |
getContentId()
Content ID.
|
String |
getContentIdRef()
Content ID.
|
long |
getContentLength()
Get the content length for this SOAPPart.
|
String |
getContentLocation()
Content location.
|
String |
getContentType()
Content type is always "text/xml" for SOAPParts.
|
int |
getCurrentForm() |
Object |
getCurrentMessage()
Get the current message, in whatever form it happens to be right now.
|
DocumentType |
getDoctype() |
Element |
getDocumentElement() |
Element |
getElementById(String elementId) |
NodeList |
getElementsByTagName(String tagname) |
NodeList |
getElementsByTagNameNS(String namespaceURI,
String localName) |
String |
getEncoding() |
SOAPEnvelope |
getEnvelope()
Gets the
SOAPEnvelope object associated with
this SOAPPart object. |
Node |
getFirstChild() |
DOMImplementation |
getImplementation() |
Node |
getLastChild() |
String |
getLocalName() |
Iterator |
getMatchingMimeHeaders(String[] match)
Get all headers that match.
|
Message |
getMessage()
Get the
Message for this Part. |
String[] |
getMimeHeader(String name)
Gets all the values of the
MimeHeader object
in this SOAPPart object that is identified by
the given String. |
String |
getNamespaceURI() |
Node |
getNextSibling() |
String |
getNodeName()
Node Implementation
|
short |
getNodeType() |
String |
getNodeValue() |
Iterator |
getNonMatchingMimeHeaders(String[] match)
Get all headers that do not match.
|
Document |
getOwnerDocument() |
Node |
getParentNode() |
String |
getPrefix() |
Node |
getPreviousSibling() |
Document |
getSOAPDocument() |
boolean |
getStandalone() |
boolean |
getStrictErrorChecking() |
String |
getVersion() |
boolean |
hasAttributes() |
boolean |
hasChildNodes() |
Node |
importNode(Node importedNode,
boolean deep) |
Node |
insertBefore(Node newChild,
Node refChild) |
boolean |
isBodyStream() |
boolean |
isSupported(String feature,
String version) |
void |
normalize() |
void |
removeAllMimeHeaders()
Removes all the
MimeHeader objects for this
SOAPEnvelope object. |
Node |
removeChild(Node oldChild) |
void |
removeMimeHeader(String header)
Removes all MIME headers that match the given name.
|
Node |
replaceChild(Node newChild,
Node oldChild) |
void |
saveChanges() |
void |
setContent(Source source)
Sets the content of the
SOAPEnvelope object
with the data from the given Source 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 message
|
void |
setEncoding(String s) |
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 |
setPrefix(String prefix) |
void |
setSOAPEnvelope(SOAPEnvelope env)
This set the SOAP Envelope for this part.
|
void |
setStandalone(boolean flag) |
void |
setStrictErrorChecking(boolean flag) |
void |
setVersion(String s) |
void |
writeTo(OutputStream os)
Write the contents to the specified stream.
|
void |
writeTo(Writer writer)
Write the contents to the specified writer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDocumentURI, getDomConfig, getInputEncoding, getXmlEncoding, getXmlStandalone, getXmlVersion, normalizeDocument, renameNode, setDocumentURI, setXmlStandalone, setXmlVersioncompareDocumentPosition, getBaseURI, getFeature, getTextContent, getUserData, isDefaultNamespace, isEqualNode, isSameNode, lookupNamespaceURI, lookupPrefix, setTextContent, setUserDataprotected static org.apache.commons.logging.Log log
public static final int FORM_STRING
public static final int FORM_INPUTSTREAM
public static final int FORM_SOAPENVELOPE
public static final int FORM_BYTES
public static final int FORM_BODYINSTREAM
public static final int FORM_FAULT
public static final int FORM_OPTIMIZED
public static final String ALLOW_FORM_OPTIMIZATION
protected Document mDocument
public Message getMessage()
Message for this Part.Message for this Partpublic void setMessage(Message msg)
msg - the Message for this partpublic String getContentType()
getContentType in interface Partpublic long getContentLength()
throws AxisFault
AxisFaultpublic void setSOAPEnvelope(SOAPEnvelope env)
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?
env - the SOAPEnvelope for this SOAPPartpublic void writeTo(OutputStream os) throws IOException
os - the java.io.OutputStream to write toIOExceptionpublic void writeTo(Writer writer) throws IOException
writer - the Writer to write toIOExceptionpublic Object getCurrentMessage()
The method name is historical. TODO: rename this for clarity; should be more like getContents.
public void setCurrentMessage(Object currMsg, int form)
currMsg - form - public int getCurrentForm()
public byte[] getAsBytes()
throws AxisFault
AxisFault - if this Part can't be serialized to the byte arraypublic String getAsString() throws AxisFault
String containing the content of this messageAxisFault - if there is an error serializing this partpublic SOAPEnvelope getAsSOAPEnvelope() throws AxisFault
SOAPEnvelope containing the message contentAxisFault - if the envelope could not be constructedpublic void addMimeHeader(String header, String value)
addMimeHeader in interface PartaddMimeHeader in class SOAPPartheader - the header to addvalue - the value of that headerpublic String getContentLocation()
getContentLocation in interface PartgetContentLocation in class SOAPPartsetContentLocation(java.lang.String)public void setContentLocation(String loc)
setContentLocation in interface PartsetContentLocation in class SOAPPartloc - the content locationgetContentLocation()public void setContentId(String newCid)
setContentId in interface PartsetContentId in class SOAPPartnewCid - new Content-IdgetContentId()public String getContentId()
getContentId in interface PartgetContentId in class SOAPPartsetContentId(java.lang.String)public String getContentIdRef()
getContentIdRef in interface Partpublic Iterator getMatchingMimeHeaders(String[] match)
getMatchingMimeHeaders in interface PartgetMatchingMimeHeaders in class SOAPPartmatch - an array of Strings giving mime header namesIterator over all values matching these headerspublic Iterator getNonMatchingMimeHeaders(String[] match)
getNonMatchingMimeHeaders in interface PartgetNonMatchingMimeHeaders in class SOAPPartmatch - an array of Strings giving mime header namesIterator over all values not matching these
headerspublic void setContent(Source source) throws SOAPException
SOAPEnvelope object
with the data from the given Source object.setContent in class SOAPPartsource - javax.xml.transform.Source object with the data to
be setSOAPException - if there is a problem in
setting the sourcegetContent()public Source getContent() throws SOAPException
Source object.getContent in class SOAPPart
javax.xml.transform.Source objectSOAPException - if the implementation cannot
convert the specified Source objectsetContent(javax.xml.transform.Source)public Iterator getAllMimeHeaders()
SOAPPart
object as an iterator over the MimeHeader
objects.getAllMimeHeaders in class SOAPPartIterator object with all of the Mime
headers for this SOAPPart objectpublic void setMimeHeader(String name, String value)
Note that RFC822 headers can contain only US-ASCII characters.
setMimeHeader in class SOAPPartname - a String giving the
header name for which to searchvalue - a String 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 new MimeHeader object.getMimeHeader(java.lang.String)public String[] getMimeHeader(String name)
MimeHeader object
in this SOAPPart object that is identified by
the given String.getMimeHeader in interface PartgetMimeHeader in class SOAPPartname - the name of the header; example:
"Content-Type"String array giving all the values for
the specified headersetMimeHeader(java.lang.String, java.lang.String)public void removeAllMimeHeaders()
MimeHeader objects for this
SOAPEnvelope object.removeAllMimeHeaders in class SOAPPartpublic void removeMimeHeader(String header)
removeMimeHeader in class SOAPPartheader - a String giving
the name of the MIME header(s) to be removedpublic SOAPEnvelope getEnvelope() throws SOAPException
SOAPEnvelope object associated with
this SOAPPart object. Once the SOAP envelope is
obtained, it can be used to get its contents.getEnvelope in class SOAPPartSOAPEnvelope object for this
SOAPPart objectSOAPException - if there is a SOAP errorpublic Document getSOAPDocument()
public DocumentType getDoctype()
getDoctype in interface Documentpublic DOMImplementation getImplementation()
getImplementation in interface Documentpublic Element getDocumentElement()
getDocumentElement in interface Documentpublic Element createElement(String tagName) throws DOMException
createElement in interface DocumenttagName - DOMExceptionpublic DocumentFragment createDocumentFragment()
createDocumentFragment in interface Documentpublic Text createTextNode(String data)
createTextNode in interface Documentpublic Comment createComment(String data)
createComment in interface Documentpublic CDATASection createCDATASection(String data) throws DOMException
createCDATASection in interface DocumentDOMExceptionpublic ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
createProcessingInstruction in interface DocumentDOMExceptionpublic Attr createAttribute(String name) throws DOMException
createAttribute in interface DocumentDOMExceptionpublic EntityReference createEntityReference(String name) throws DOMException
createEntityReference in interface DocumentDOMExceptionpublic NodeList getElementsByTagName(String tagname)
getElementsByTagName in interface Documentpublic Node importNode(Node importedNode, boolean deep) throws DOMException
importNode in interface DocumentDOMExceptionpublic Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException
createElementNS in interface DocumentDOMExceptionpublic Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
createAttributeNS in interface DocumentDOMExceptionpublic NodeList getElementsByTagNameNS(String namespaceURI, String localName)
getElementsByTagNameNS in interface Documentpublic Element getElementById(String elementId)
getElementById in interface Documentpublic String getEncoding()
public void setEncoding(String s)
public boolean getStandalone()
public void setStandalone(boolean flag)
public boolean getStrictErrorChecking()
getStrictErrorChecking in interface Documentpublic void setStrictErrorChecking(boolean flag)
setStrictErrorChecking in interface Documentpublic String getVersion()
public void setVersion(String s)
public Node adoptNode(Node node) throws DOMException
adoptNode in interface DocumentDOMExceptionpublic String getNodeName()
getNodeName in interface Nodepublic String getNodeValue() throws DOMException
getNodeValue in interface NodeDOMExceptionpublic void setNodeValue(String nodeValue) throws DOMException
setNodeValue in interface NodeDOMExceptionpublic short getNodeType()
getNodeType in interface Nodepublic Node getParentNode()
getParentNode in interface Nodepublic NodeList getChildNodes()
getChildNodes in interface Nodepublic Node getFirstChild()
getFirstChild in interface Nodepublic Node getLastChild()
getLastChild in interface Nodepublic Node getPreviousSibling()
getPreviousSibling in interface Nodepublic Node getNextSibling()
getNextSibling in interface Nodepublic NamedNodeMap getAttributes()
getAttributes in interface Nodepublic Document getOwnerDocument()
getOwnerDocument in interface Nodepublic Node insertBefore(Node newChild, Node refChild) throws DOMException
insertBefore in interface NodeDOMExceptionpublic Node replaceChild(Node newChild, Node oldChild) throws DOMException
replaceChild in interface NodeDOMExceptionpublic Node removeChild(Node oldChild) throws DOMException
removeChild in interface NodeDOMExceptionpublic Node appendChild(Node newChild) throws DOMException
appendChild in interface NodeDOMExceptionpublic boolean hasChildNodes()
hasChildNodes in interface Nodepublic boolean isSupported(String feature, String version)
isSupported in interface Nodepublic String getNamespaceURI()
getNamespaceURI in interface Nodepublic void setPrefix(String prefix) throws DOMException
setPrefix in interface NodeDOMExceptionpublic String getLocalName()
getLocalName in interface Nodepublic boolean hasAttributes()
hasAttributes in interface Nodepublic boolean isBodyStream()
Copyright © The Apache Software Foundation. All Rights Reserved.