SOAPException (Java EE 5)

Java EE API


javax.xml.soap Class SOAPException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by javax.xml.soap.SOAPException
All Implemented Interfaces:
Serializable

public class SOAPException
extends Exception

Extends: Throwable > Exception

当发生 SOAP 异常时,抛出此异常。SOAPException 对象可以包含给出异常原因的 String 或嵌入的 Throwable 对象,也可以同时包含两者。此类提供检索原因消息的方法和检索嵌入 Throwable 对象的方法。

抛出 SOAPException 对象的通常原因是难以设置头、无法发送消息以及无法获取与提供者的连接之类的问题。嵌入 Throwable 对象的原因包括诸如输入/输出错误之类的问题或解析问题,如解析头时出现错误。

英文文档:

An exception that signals that a SOAP exception has occurred. A SOAPException object may contain a String that gives the reason for the exception, an embedded Throwable object, or both. This class provides methods for retrieving reason messages and for retrieving the embedded Throwable object.

Typical reasons for throwing a SOAPException object are problems such as difficulty setting a header, not being able to send a message, and not being able to get a connection with the provider. Reasons for embedding a Throwable object include problems such as input/output errors or a parsing problem, such as an error in parsing a header.

See Also:
Serialized Form

Constructor Summary
 
Method Summary
 Throwable
 String
 Throwable
 
Methods inherited from class java.lang.Throwable
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public SOAPException()
构造不带原因或内置 Throwable 对象的 SOAPException 对象。
英文文档:

SOAPException

public SOAPException()
Constructs a SOAPException object with no reason or embedded Throwable object.


public SOAPException(String reason)
构造一个 SOAPException 对象,使用给定 String 作为抛出异常的原因。
reason 对导致异常的原因的描述
英文文档:

SOAPException

public SOAPException(String reason)
Constructs a SOAPException object with the given String as the reason for the exception being thrown.

Parameters:
reason - a description of what caused the exception


public SOAPException(String reason, Throwable cause)
构造一个 SOAPException 对象,使用给定 String 作为抛出异常的原因,使用给定 Throwable 对象作为嵌入的异常。
reason 对导致异常的原因的描述
cause 要嵌入此 SOAPException 对象的 Throwable 对象
英文文档:

SOAPException

public SOAPException(String reason,
                     Throwable cause)
Constructs a SOAPException object with the given String as the reason for the exception being thrown and the given Throwable object as an embedded exception.

Parameters:
reason - a description of what caused the exception
cause - a Throwable object that is to be embedded in this SOAPException object


public SOAPException(Throwable cause)
构造使用给定 Throwable 对象初始化的 SOAPException 对象。
英文文档:

SOAPException

public SOAPException(Throwable cause)
Constructs a SOAPException object initialized with the given Throwable object.

Method Detail

public String getMessage()
返回此 SOAPException 对象的详细消息。

如果有嵌入的 Throwable 对象,并且 SOAPException 对象没有自己的详细消息,则此方法将返回嵌入的 Throwable 对象的详细消息。

returnSOAPException 的错误或警告消息,如果没有此类消息,则返回嵌入的 Throwable 对象(如果有)的消息

英文文档:

getMessage

public String getMessage()
Returns the detail message for this SOAPException object.

If there is an embedded Throwable object, and if the SOAPException object has no detail message of its own, this method will return the detail message from the embedded Throwable object.

Overrides:
getMessage in class Throwable
Returns:
the error or warning message for this SOAPException or, if it has none, the message of the embedded Throwable object, if there is one

public Throwable getCause()
返回此 SOAPException 中嵌入的 Throwable 对象(如果有)。否则,此方法返回 null
return 嵌入的 Throwable 对象,如果没有此类对象,则返回 null
英文文档:

getCause

public Throwable getCause()
Returns the Throwable object embedded in this SOAPException if there is one. Otherwise, this method returns null.

Overrides:
getCause in class Throwable
Returns:
the embedded Throwable object or null if there is none

public Throwable initCause(Throwable cause)
使用给定的 Throwable 对象初始化此 SOAPException 对象的 cause 字段。

此方法至多可以调用一次。此方法通常从构造方法中调用,或者在构造方法返回新的 SOAPException 对象后立即调用。如果此 SOAPException 对象是使用构造方法 #SOAPException(Throwable)#SOAPException(String,Throwable) 创建的,则意味着它的 cause 字段已经有一个值,此方法一次也不能调用。

cause 导致抛出此 SOAPException 对象的 Throwable 对象。保存此参数的值,以便以后通过 #getCause() 方法检索它。此参数值可以为 null,指示 cause 不存在或是未知的。
return 对此 SOAPException 实例的引用
ThrowsIllegalArgumentException: 如果 cause 是此 Throwable 对象。(Throwable 对象不能是它自己的 cause。)
ThrowsIllegalStateException: 如果此 SOAPException 对象的 cause 已经初始化

英文文档:

initCause

public Throwable initCause(Throwable cause)
Initializes the cause field of this SOAPException object with the given Throwable object.

This method can be called at most once. It is generally called from within the constructor or immediately after the constructor has returned a new SOAPException object. If this SOAPException object was created with the constructor SOAPException(Throwable) or SOAPException(String,Throwable), meaning that its cause field already has a value, this method cannot be called even once.

Overrides:
initCause in class Throwable
Parameters:
cause - the Throwable object that caused this SOAPException object to be thrown. The value of this parameter is saved for later retrieval by the getCause() method. A null value is permitted and indicates that the cause is nonexistent or unknown.
Returns:
a reference to this SOAPException instance
Throws:
IllegalArgumentException - if cause is this Throwable object. (A Throwable object cannot be its own cause.)
IllegalStateException - if the cause for this SOAPException object has already been initialized


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!