|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
javax.xml.soap Class SOAPPart
java.lang.Objectjavax.xml.soap.SOAPPart
The container for the SOAP-specific portion of a SOAPMessage
object. All messages are required to have a SOAP part, so when a
SOAPMessage object is created, it will automatically
have a SOAPPart object.
A SOAPPart object is a MIME part and has the MIME headers
Content-Id, Content-Location, and Content-Type. Because the value of
Content-Type must be "text/xml", a SOAPPart object automatically
has a MIME header of Content-Type with its value set to "text/xml".
The value must be "text/xml" because content in the SOAP part of a
message must be in XML format. Content that is not of type "text/xml"
must be in an AttachmentPart object rather than in the
SOAPPart object.
When a message is sent, its SOAP part must have the MIME header Content-Type set to "text/xml". Or, from the other perspective, the SOAP part of any message that is received must have the MIME header Content-Type with a value of "text/xml".
A client can access the SOAPPart object of a
SOAPMessage object by
calling the method SOAPMessage.getSOAPPart. The
following line of code, in which message is a
SOAPMessage object, retrieves the SOAP part of a message.
SOAPPart soapPart = message.getSOAPPart();
A SOAPPart object contains a SOAPEnvelope object,
which in turn contains a SOAPBody object and a
SOAPHeader object.
The SOAPPart method getEnvelope can be used
to retrieve the SOAPEnvelope object.
| 字段摘要 |
|---|
| 构造器摘要 | |
|---|---|
SOAPPart()
|
|
| 方法摘要 | |
|---|---|
abstract void |
addMimeHeader(String name,
String value)
Creates a MimeHeader object with the specified
name and value and adds it to this SOAPPart object. |
abstract Iterator |
getAllMimeHeaders()
Retrieves all the headers for this SOAPPart object
as an iterator over the MimeHeader objects. |
abstract Source |
getContent()
Returns the content of the SOAPEnvelope as a JAXP Source
object. |
String |
getContentId()
Retrieves the value of the MIME header whose name is "Content-Id". |
String |
getContentLocation()
Retrieves the value of the MIME header whose name is "Content-Location". |
abstract SOAPEnvelope |
getEnvelope()
Gets the SOAPEnvelope object associated with this
SOAPPart object. |
abstract Iterator |
getMatchingMimeHeaders(String[] names)
Retrieves all MimeHeader objects that match a name in
the given array. |
abstract String[] |
getMimeHeader(String name)
Gets all the values of the MimeHeader object
in this SOAPPart object that
is identified by the given String. |
abstract Iterator |
getNonMatchingMimeHeaders(String[] names)
Retrieves all MimeHeader objects whose name does
not match a name in the given array. |
abstract void |
removeAllMimeHeaders()
Removes all the MimeHeader objects for this
SOAPEnvelope object. |
abstract void |
removeMimeHeader(String header)
Removes all MIME headers that match the given name. |
abstract void |
setContent(Source source)
Sets the content of the SOAPEnvelope object with the data
from the given Source object. |
void |
setContentId(String contentId)
Sets the value of the MIME header named "Content-Id" to the given String. |
void |
setContentLocation(String contentLocation)
Sets the value of the MIME header "Content-Location" to the given String. |
abstract 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. |
| 类方法继承 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
| Methods inherited from interface javax.xml.soap.Node |
|---|
detachNode, getParentElement, getValue, recycleNode, setParentElement, setValue |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
| 构造器详细信息 |
|---|
SOAPPart
public SOAPPart()
| 方法详细信息 |
|---|
getEnvelope
public abstract SOAPEnvelope getEnvelope() throws SOAPException
- Gets the
SOAPEnvelopeobject associated with thisSOAPPartobject. Once the SOAP envelope is obtained, it can be used to get its contents. - 返回:
- the
SOAPEnvelopeobject for thisSOAPPartobject - 抛出异常:
SOAPException- if there is a SOAP error
getContentId
public String getContentId()
- Retrieves the value of the MIME header whose name is "Content-Id".
- 返回:
- a
Stringgiving the value of the MIME header named "Content-Id" - 另请参见:
setContentId(java.lang.String)
getContentLocation
public String getContentLocation()
- Retrieves the value of the MIME header whose name is "Content-Location".
- 返回:
- a
Stringgiving the value of the MIME header whose name is "Content-Location" - 另请参见:
setContentLocation(java.lang.String)
setContentId
public void setContentId(String contentId)
- Sets the value of the MIME header named "Content-Id"
to the given
String. - 参数:
contentId- aStringgiving the value of the MIME header "Content-Id"- 抛出异常:
IllegalArgumentException- if there is a problem in setting the content id- 另请参见:
getContentId()
setContentLocation
public void setContentLocation(String contentLocation)
- Sets the value of the MIME header "Content-Location"
to the given
String. - 参数:
contentLocation- aStringgiving the value of the MIME header "Content-Location"- 抛出异常:
IllegalArgumentException- if there is a problem in setting the content location.- 另请参见:
getContentLocation()
removeMimeHeader
public abstract void removeMimeHeader(String header)
- Removes all MIME headers that match the given name.
- 参数:
header- aStringgiving the name of the MIME header(s) to be removed
removeAllMimeHeaders
public abstract void removeAllMimeHeaders()
- Removes all the
MimeHeaderobjects for thisSOAPEnvelopeobject.
getMimeHeader
public abstract String[] getMimeHeader(String name)
- Gets all the values of the
MimeHeaderobject in thisSOAPPartobject that is identified by the givenString. - 参数:
name- the name of the header; example: "Content-Type"- 返回:
- a
Stringarray giving all the values for the specified header - 另请参见:
setMimeHeader(java.lang.String, java.lang.String)
setMimeHeader
public abstract 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. 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.
- 参数:
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.- 抛出异常:
IllegalArgumentException- if there was a problem with the specified mime header name or value- 另请参见:
getMimeHeader(java.lang.String)
addMimeHeader
public abstract void addMimeHeader(String name, String value)
- Creates a
MimeHeaderobject with the specified name and value and adds it to thisSOAPPartobject. If aMimeHeaderwith the specified name already exists, this method adds the specified value to the already existing value(s).Note that RFC822 headers can contain only US-ASCII characters.
- 参数:
name- aStringgiving the header namevalue- aStringgiving the value to be set or added- 抛出异常:
IllegalArgumentException- if there was a problem with the specified mime header name or value
getAllMimeHeaders
public abstract Iterator getAllMimeHeaders()
- Retrieves all the headers for this
SOAPPartobject as an iterator over theMimeHeaderobjects. - 返回:
- an
Iteratorobject with all of the Mime headers for thisSOAPPartobject
getMatchingMimeHeaders
public abstract Iterator getMatchingMimeHeaders(String[] names)
- Retrieves all
MimeHeaderobjects that match a name in the given array. - 参数:
names- aStringarray with the name(s) of the MIME headers to be returned- 返回:
- all of the MIME headers that match one of the names in the
given array, returned as an
Iteratorobject
getNonMatchingMimeHeaders
public abstract Iterator getNonMatchingMimeHeaders(String[] names)
- Retrieves all
MimeHeaderobjects whose name does not match a name in the given array. - 参数:
names- aStringarray with the name(s) of the MIME headers not to be returned- 返回:
- all of the MIME headers in this
SOAPPartobject except those that match one of the names in the given array. The nonmatching MIME headers are returned as anIteratorobject.
setContent
public abstract void setContent(Source source) throws SOAPException
- Sets the content of the
SOAPEnvelopeobject with the data from the givenSourceobject. ThisSourcemust contain a valid SOAP document. - 参数:
source- thejavax.xml.transform.Sourceobject with the data to be set- 抛出异常:
SOAPException- if there is a problem in setting the source- 另请参见:
getContent()
getContent
public abstract Source getContent() throws SOAPException
- Returns the content of the SOAPEnvelope as a JAXP
Sourceobject. - 返回:
- the content as a
javax.xml.transform.Sourceobject - 抛出异常:
SOAPException- if the implementation cannot convert the specifiedSourceobject- 另请参见:
setContent(javax.xml.transform.Source)
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.
javax.xml.soap.SOAPPart