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, wait
getDocumentURI, getDomConfig, getInputEncoding, getXmlEncoding, getXmlStandalone, getXmlVersion, normalizeDocument, renameNode, setDocumentURI, setXmlStandalone, setXmlVersion
compareDocumentPosition, getBaseURI, getFeature, getTextContent, getUserData, isDefaultNamespace, isEqualNode, isSameNode, lookupNamespaceURI, lookupPrefix, setTextContent, setUserData
protected 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 Part
public void setMessage(Message msg)
msg
- the Message
for this partpublic String getContentType()
getContentType
in interface Part
public long getContentLength() throws AxisFault
AxisFault
public 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 SOAPPart
public void writeTo(OutputStream os) throws IOException
os
- the java.io.OutputStream
to write toIOException
public void writeTo(Writer writer) throws IOException
writer
- the Writer
to write toIOException
public 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 Part
addMimeHeader
in class SOAPPart
header
- the header to addvalue
- the value of that headerpublic String getContentLocation()
getContentLocation
in interface Part
getContentLocation
in class SOAPPart
setContentLocation(java.lang.String)
public void setContentLocation(String loc)
setContentLocation
in interface Part
setContentLocation
in class SOAPPart
loc
- the content locationgetContentLocation()
public void setContentId(String newCid)
setContentId
in interface Part
setContentId
in class SOAPPart
newCid
- new Content-IdgetContentId()
public String getContentId()
getContentId
in interface Part
getContentId
in class SOAPPart
setContentId(java.lang.String)
public String getContentIdRef()
getContentIdRef
in interface Part
public Iterator getMatchingMimeHeaders(String[] match)
getMatchingMimeHeaders
in interface Part
getMatchingMimeHeaders
in class SOAPPart
match
- an array of String
s giving mime header namesIterator
over all values matching these headerspublic Iterator getNonMatchingMimeHeaders(String[] match)
getNonMatchingMimeHeaders
in interface Part
getNonMatchingMimeHeaders
in class SOAPPart
match
- an array of String
s 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 SOAPPart
source
- 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 SOAPPart
Iterator
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 SOAPPart
name
- 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 Part
getMimeHeader
in class SOAPPart
name
- 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 SOAPPart
public void removeMimeHeader(String header)
removeMimeHeader
in class SOAPPart
header
- 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 SOAPPart
SOAPEnvelope
object for this
SOAPPart
objectSOAPException
- if there is a SOAP errorpublic Document getSOAPDocument()
public DocumentType getDoctype()
getDoctype
in interface Document
public DOMImplementation getImplementation()
getImplementation
in interface Document
public Element getDocumentElement()
getDocumentElement
in interface Document
public Element createElement(String tagName) throws DOMException
createElement
in interface Document
tagName
- DOMException
public DocumentFragment createDocumentFragment()
createDocumentFragment
in interface Document
public Text createTextNode(String data)
createTextNode
in interface Document
public Comment createComment(String data)
createComment
in interface Document
public CDATASection createCDATASection(String data) throws DOMException
createCDATASection
in interface Document
DOMException
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
createProcessingInstruction
in interface Document
DOMException
public Attr createAttribute(String name) throws DOMException
createAttribute
in interface Document
DOMException
public EntityReference createEntityReference(String name) throws DOMException
createEntityReference
in interface Document
DOMException
public NodeList getElementsByTagName(String tagname)
getElementsByTagName
in interface Document
public Node importNode(Node importedNode, boolean deep) throws DOMException
importNode
in interface Document
DOMException
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException
createElementNS
in interface Document
DOMException
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
createAttributeNS
in interface Document
DOMException
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
getElementsByTagNameNS
in interface Document
public Element getElementById(String elementId)
getElementById
in interface Document
public String getEncoding()
public void setEncoding(String s)
public boolean getStandalone()
public void setStandalone(boolean flag)
public boolean getStrictErrorChecking()
getStrictErrorChecking
in interface Document
public void setStrictErrorChecking(boolean flag)
setStrictErrorChecking
in interface Document
public String getVersion()
public void setVersion(String s)
public Node adoptNode(Node node) throws DOMException
adoptNode
in interface Document
DOMException
public String getNodeName()
getNodeName
in interface Node
public String getNodeValue() throws DOMException
getNodeValue
in interface Node
DOMException
public void setNodeValue(String nodeValue) throws DOMException
setNodeValue
in interface Node
DOMException
public short getNodeType()
getNodeType
in interface Node
public Node getParentNode()
getParentNode
in interface Node
public NodeList getChildNodes()
getChildNodes
in interface Node
public Node getFirstChild()
getFirstChild
in interface Node
public Node getLastChild()
getLastChild
in interface Node
public Node getPreviousSibling()
getPreviousSibling
in interface Node
public Node getNextSibling()
getNextSibling
in interface Node
public NamedNodeMap getAttributes()
getAttributes
in interface Node
public Document getOwnerDocument()
getOwnerDocument
in interface Node
public Node insertBefore(Node newChild, Node refChild) throws DOMException
insertBefore
in interface Node
DOMException
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
replaceChild
in interface Node
DOMException
public Node removeChild(Node oldChild) throws DOMException
removeChild
in interface Node
DOMException
public Node appendChild(Node newChild) throws DOMException
appendChild
in interface Node
DOMException
public boolean hasChildNodes()
hasChildNodes
in interface Node
public boolean isSupported(String feature, String version)
isSupported
in interface Node
public String getNamespaceURI()
getNamespaceURI
in interface Node
public void setPrefix(String prefix) throws DOMException
setPrefix
in interface Node
DOMException
public String getLocalName()
getLocalName
in interface Node
public boolean hasAttributes()
hasAttributes
in interface Node
public boolean isBodyStream()
Copyright © The Apache Software Foundation. All Rights Reserved.