public interface SOAPFault extends SOAPBodyElement
SOAPBody对象中包含错误和/或状态信息的元素。
该信息可能与SOAPMessage对象中的错误或与消息本身内容无关的问题有关。
与消息本身无关的问题通常是处理中的错误,例如不能与上游服务器进行通信。
取决于protocol而创建指定MessageFactory例如, SOAPFault具有如在SOAP 1.1 / SOAP 1.2规范中定义的子元素。
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| Modifier and Type | Method and Description |
|---|---|
Detail |
addDetail()
创建可选的
Detail对象,并将其设置为
Detail对象的
SOAPFault对象。
|
void |
addFaultReasonText(String text, Locale locale)
追加或替换包含指定文本消息的原因文本项和从
locale派生的
xml:lang 。
|
void |
appendFaultSubcode(QName subcode)
在此
SOAPFault包含的子代码序列的末尾添加一个子代码。
|
Detail |
getDetail()
返回此
SOAPFault对象的可选detail元素。
|
String |
getFaultActor()
获取此
SOAPFault对象的故障演员。
|
String |
getFaultCode()
获取此
SOAPFault对象的故障代码。
|
Name |
getFaultCodeAsName()
获取此
SOAPFault对象的强制SOAP 1.1故障代码作为SAAJ
Name对象。
|
QName |
getFaultCodeAsQName()
获取此
SOAPFault对象的故障代码作为
QName对象。
|
String |
getFaultNode()
返回此
SOAPFault对象的可选Node元素值。
|
Iterator |
getFaultReasonLocales()
在
Iterator的不同序列上
Locale ,其中有相关的原因文本项。
|
String |
getFaultReasonText(Locale locale)
返回与给定
Locale的原因文本。
|
Iterator |
getFaultReasonTexts()
返回
Iterator的序列
String对象,其中包含此
SOAPFault所有原因文本项。
|
String |
getFaultRole()
返回此
SOAPFault对象的可选Role元素值。
|
String |
getFaultString()
获取此
SOAPFault对象的故障字符串。
|
Locale |
getFaultStringLocale()
获取此
SOAPFault对象的故障字符串的区域设置。
|
Iterator |
getFaultSubcodes()
获取此子码
SOAPFault为在一个迭代
QNames 。
|
boolean |
hasDetail()
如果这个
SOAPFault有一个
Detail子元素,则返回true,否则返回false。
|
void |
removeAllFaultSubcodes()
删除此
SOAPFault可能包含的任何子
SOAPFault 。
|
void |
setFaultActor(String faultActor)
使用给定的故障演员设置此
SOAPFault对象。
|
void |
setFaultCode(Name faultCodeQName)
使用给定的故障代码设置此
SOAPFault对象。
|
void |
setFaultCode(QName faultCodeQName)
使用给定的故障代码设置此
SOAPFault对象。
|
void |
setFaultCode(String faultCode)
使用给定故障代码设置此
SOAPFault对象。
|
void |
setFaultNode(String uri)
创建或替换此
SOAPFault对象的任何现有Node元素值。
|
void |
setFaultRole(String uri)
创建或替换此
SOAPFault对象的任何现有Role元素值。
|
void |
setFaultString(String faultString)
将此
SOAPFault对象的故障字符串设置为给定的字符串。
|
void |
setFaultString(String faultString, Locale locale)
将此
SOAPFault对象的故障字符串设置为给定的字符串,并将其定位到给定的区域设置。
|
addAttribute, addAttribute, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addNamespaceDeclaration, addTextNode, createQName, getAllAttributes, getAllAttributesAsQNames, getAttributeValue, getAttributeValue, getChildElements, getChildElements, getChildElements, getElementName, getElementQName, getEncodingStyle, getNamespacePrefixes, getNamespaceURI, getVisibleNamespacePrefixes, removeAttribute, removeAttribute, removeContents, removeNamespaceDeclaration, setElementQName, setEncodingStyledetachNode, getParentElement, getValue, recycleNode, setParentElement, setValuegetAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNSappendChild, 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, setUserDatavoid setFaultCode(Name faultCodeQName) throws SOAPException
SOAPFault对象。
在SOAP 1.1规范中定义了有关故障信息的故障代码。 故障代码是必需的,必须是Name 。 该方法提供了设置故障代码的便捷方式。 例如,
SOAPEnvelope se = ...;
// Create a qualified name in the SOAP namespace with a localName
// of "Client". Note that prefix parameter is optional and is null
// here which causes the implementation to use an appropriate prefix.
Name qname = se.createName("Client", null,
SOAPConstants.URI_NS_SOAP_ENVELOPE);
SOAPFault fault = ...;
fault.setFaultCode(qname);
最好使用这种方法超过setFaultCode(String) 。
faultCodeQName - 给出要设置的故障代码的Name对象。
它必须是命名空间限定的。
SOAPException - 如果将
faultcode元素添加到底层XML树中有错误。
getFaultCodeAsName()
void setFaultCode(QName faultCodeQName) throws SOAPException
SOAPFault对象。
最好使用这种方法超过setFaultCode(Name) 。
faultCodeQName - 一个QName对象,给出要设置的故障代码。
它必须是命名空间限定的。
SOAPException - 如果将
faultcode元素添加到底层XML树中有错误。
getFaultCodeAsQName() ,
setFaultCode(Name) ,
getFaultCodeAsQName()
void setFaultCode(String faultCode) throws SOAPException
SOAPFault对象与给出故障代码。
有关故障信息的故障代码在SOAP 1.1规范中定义。 此元素在SOAP 1.1中是必需的。 因为故障代码是QName,所以最好使用这种方法的setFaultCode(Name)形式。
faultCode - 一个String给出要设置的故障代码。
它必须是前缀在命名空间声明中定义的形式“prefix:localName”。
SOAPException - 如果将
faultCode添加到底层XML树中有错误。
setFaultCode(Name) ,
getFaultCode() ,
SOAPElement.addNamespaceDeclaration(java.lang.String, java.lang.String)
Name getFaultCodeAsName()
SOAPFault对象的强制性SOAP 1.1故障代码作为SAAJ Name对象。
SOAP 1.1规范要求“faultcode”元素的值为QName类型。
此方法以SAAJ Name对象的形式将元素的内容作为QName返回。
应使用此方法代替getFaultCode方法,因为它允许应用程序轻松访问命名空间名称,无需额外的解析。
Name故障码的Name
setFaultCode(Name)
QName getFaultCodeAsQName()
SOAPFault对象的故障代码作为
QName对象。
QName故障码的QName
setFaultCode(QName)
Iterator getFaultSubcodes()
SOAPFault为在一个迭代
QNames 。
Iterator访问的序列QNames 。
这Iterator不应该支持可选的remove方法。
子代码的返回顺序反映了从上到下的故障中存在的子代码的层次结构。
UnsupportedOperationException - 如果此消息不支持SOAP 1.2子代码概念。
void removeAllFaultSubcodes()
SOAPFault可能包含的任何子SOAPFault 。
随后呼叫getFaultSubcodes直到通话将返回一个空迭代appendFaultSubcode而成。
UnsupportedOperationException - 如果此消息不支持SOAP 1.2概念的子代码。
void appendFaultSubcode(QName subcode) throws SOAPException
SOAPFault包含的子代码序列的末尾添加一个子代码。
在SOAP 1.2中引入的子代码由基于SOAP Fault的强制代码子元素的子元素的递归序列表示。
subcode - 包含子代码值的QName。
SOAPException - 如果设置子代码时出现错误
UnsupportedOperationException - 如果此消息不支持SOAP 1.2子代码概念。
String getFaultCode()
SOAPFault对象的故障代码。
String带有故障代码
getFaultCodeAsName() ,
setFaultCode(javax.xml.soap.Name)
void setFaultActor(String faultActor) throws SOAPException
SOAPFault对象。
故障演员是导致故障发生的消息路径中的接收者。
如果这个SOAPFault支持SOAP 1.2,那么这个调用相当于setFaultRole(String)
faultActor - a
String识别导致该
SOAPFault对象的演员
SOAPException - 如果将
faultActor添加到底层XML树中有错误。
getFaultActor()
String getFaultActor()
SOAPFault对象的故障演员。
如果这个SOAPFault支持SOAP 1.2,那么这个调用相当于getFaultRole()
String给导致这个
SOAPFault对象的消息路径中的actor
setFaultActor(java.lang.String)
void setFaultString(String faultString) throws SOAPException
SOAPFault对象的故障字符串设置为给定的字符串。
如果这个SOAPFault是支持SOAP 1.2的消息的一部分,则此调用等效于:
addFaultReasonText(faultString, Locale.getDefault());
faultString - a
String给出了故障的解释
SOAPException - 如果将
faultString添加到底层XML树中有错误。
getFaultString()
void setFaultString(String faultString, Locale locale) throws SOAPException
SOAPFault对象的故障字符串设置为给定的字符串,并将其定位到给定的区域设置。
如果这个SOAPFault是支持SOAP 1.2的消息的一部分,则此调用等效于:
addFaultReasonText(faultString, locale);
faultString - a
String给出了故障的解释
locale -一个Locale对象,指示的母语faultString
SOAPException - 如果将
faultString添加到底层XML树中有错误。
getFaultString()
String getFaultString()
SOAPFault对象的故障字符串。
如果这个SOAPFault是支持SOAP 1.2的消息的一部分,则此调用等效于:
String reason = null;
try {
reason = (String) getFaultReasonTexts().next();
} catch (SOAPException e) {}
return reason;
String给出了故障的解释
setFaultString(String) ,
setFaultString(String, Locale)
Locale getFaultStringLocale()
SOAPFault对象的故障字符串的区域设置。
如果这个SOAPFault是支持SOAP 1.2的消息的一部分,则此调用等效于:
Locale locale = null;
try {
locale = (Locale) getFaultReasonLocales().next();
} catch (SOAPException e) {}
return locale;
Locale表示的错误字符串或的本机语言对象
null如果没有指定的区域设置
setFaultString(String, Locale)
boolean hasDetail()
SOAPFault有一个Detail子元素,则返回true,否则返回false。
相当于(getDetail()!=null) 。
SOAPFault有一个
Detail子元素,则为true,否则为false。
Detail getDetail()
SOAPFault对象的可选detail元素。
Detail对象携带应用程序特定的错误信息,如果这是SOAP 1.1 Fault,则错误信息的范围仅限于SOAPBodyElement对象中的故障。
Detail对象,如果存在应用程序特定的错误信息,否则为空
Detail addDetail() throws SOAPException
Detail对象,并将其设置为Detail对象的SOAPFault对象。
当故障已包含详细信息时,添加详细信息是非法的。 因此,只有在删除现有的细节之后才应该调用此方法。
Detail对象
SOAPException - 如果此
SOAPFault对象已经包含有效的
Detail对象
Iterator getFaultReasonLocales() throws SOAPException
Iterator的不同序列上Locale ,其中有相关的原因文本项。
这些Locale的任何一个可以用于调用getFaultReasonText以获取原理文本字符串的本地化版本。
Iterator在一系列
Locale对象上,其中有相关的原因文本项。
SOAPException - 如果在检索故障原因区域设置时出现错误。
UnsupportedOperationException - 如果此消息不支持SOAP 1.2故障原因概念。
Iterator getFaultReasonTexts() throws SOAPException
Iterator的序列
String对象,其中包含此
SOAPFault所有原因文本项。
Iterator在env:Fault / env:Reason / env:Text items。
SOAPException - 如果在检索故障原因文本时出现错误。
UnsupportedOperationException - 如果此消息不支持SOAP 1.2故障原因概念。
String getFaultReasonText(Locale locale) throws SOAPException
Locale的原因文本。
如果存在多个此类原因文本,则返回第一个匹配的文本
locale - -所述
Locale局部原因文本期望进行
locale的原因文本
SOAPException - 如果在检索故障原因文本中指定区域设置时出现错误。
UnsupportedOperationException - 如果此消息不支持SOAP 1.2故障原因概念。
getFaultString()
void addFaultReasonText(String text, Locale locale) throws SOAPException
locale派生的xml:lang 。
如果具有此xml:lang的原因文本项目已存在,则其文本值将替换为text 。
locale参数不应该是null
代码示例:
SOAPFault fault = ...;
fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);
text - - 原因信息字符串
locale - - 表示消息的区域设置的区域设置对象
SOAPException - 如果在添加原因文本时出现错误或通过的
locale是
null 。
UnsupportedOperationException - 如果此消息不支持SOAP 1.2故障原因概念。
String getFaultNode()
SOAPFault对象的可选Node元素值。
Node元素在SOAP 1.2中是可选的。
null如果没有,
null
UnsupportedOperationException - 如果此消息不支持故障节点的SOAP 1.2概念。
void setFaultNode(String uri) throws SOAPException
SOAPFault对象的任何现有Node元素值。
Node元素在SOAP 1.2中是可选的。
SOAPException - 如果为此
SOAPFault对象设置节点时
SOAPFault 。
UnsupportedOperationException - 如果此消息不支持故障节点的SOAP 1.2概念。
String getFaultRole()
SOAPFault对象的可选Role元素值。
Role元素在SOAP 1.2中是可选的。
null如果没有)
UnsupportedOperationException - 如果此消息不支持SOAP 1.2概念的故障角色。
void setFaultRole(String uri) throws SOAPException
SOAPFault对象的任何现有Role元素值。
Role元素在SOAP 1.2中是可选的。
uri - - 角色的URI
SOAPException - 如果设置此
SOAPFault对象的角色有错误。
UnsupportedOperationException - 如果此消息不支持“故障角色”的SOAP 1.2概念。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.