001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the License). You may not use this file except in
005: * compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * Header Notice in each file and include the License file
014: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
015: * If applicable, add the following below the CDDL Header,
016: * with the fields enclosed by brackets [] replaced by
017: * you own identifying information:
018: * "Portions Copyrighted [year] [name of copyright owner]"
019: *
020: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
021: */
022:
023: package com.sun.xml.wss.impl;
024:
025: import javax.xml.namespace.QName;
026: import javax.xml.soap.Detail;
027: import com.sun.xml.wss.*;
028:
029: /** The <code>WssSoapFaultException</code> exception represents a
030: * SOAP fault.
031: *
032: * <p>The message part in the SOAP fault maps to the contents of
033: * <code>faultdetail</code> element accessible through the
034: * <code>getDetail</code> method on the <code>WssSoapFaultException</code>.
035: * The method <code>createDetail</code> on the
036: * <code>javax.xml.soap.SOAPFactory</code> creates an instance
037: * of the <code>javax.xml.soap.Detail</code>.
038: *
039: * <p>The <code>faultstring</code> provides a human-readable
040: * description of the SOAP fault. The <code>faultcode</code>
041: * element provides an algorithmic mapping of the SOAP fault.
042: *
043: * <p>Refer to SOAP 1.1 and WSDL 1.1 specifications for more
044: * details of the SOAP faults.
045: *
046: * @see javax.xml.soap.Detail
047: * @see javax.xml.soap.SOAPFactory#createDetail
048: **/
049:
050: public class WssSoapFaultException extends java.lang.RuntimeException {
051:
052: private QName faultcode;
053: private String faultstring;
054: private String faultactor;
055: private Detail detail;
056:
057: /** Constructor for the SOAPFaultException
058: * @param faultcode <code>QName</code> for the SOAP faultcode
059: * @param faultstring <code>faultstring</code> element of SOAP fault
060: * @param faultactor <code>faultactor</code> element of SOAP fault
061: * @param faultdetail <code>faultdetail</code> element of SOAP fault
062: *
063: * @see javax.xml.soap.SOAPFactory#createDetail
064: */
065: public WssSoapFaultException(QName faultcode, String faultstring,
066: String faultactor, javax.xml.soap.Detail faultdetail) {
067: super (faultstring);
068: this .faultcode = faultcode;
069: this .faultstring = faultstring;
070: this .faultactor = faultactor;
071: this .detail = faultdetail;
072: }
073:
074: /** Gets the <code>faultcode</code> element. The <code>faultcode</code>
075: * element provides an algorithmic mechanism for identifying the
076: * fault. SOAP defines a small set of SOAP fault codes covering
077: * basic SOAP faults.
078: *
079: * @return QName of the faultcode element
080: */
081: public QName getFaultCode() {
082: return this .faultcode;
083: }
084:
085: /** Gets the <code>faultstring</code> element. The <code>faultstring</code>
086: * provides a human-readable description of the SOAP fault and
087: * is not intended for algorithmic processing.
088: *
089: * @return faultstring element of the SOAP fault
090: */
091: public String getFaultString() {
092: return this .faultstring;
093: }
094:
095: /** Gets the <code>faultactor</code> element. The <code>faultactor</code>
096: * element provides information about which SOAP node on the
097: * SOAP message path caused the fault to happen. It indicates
098: * the source of the fault.
099: *
100: * @return <code>faultactor</code> element of the SOAP fault
101: */
102: public String getFaultActor() {
103: return this .faultactor;
104: }
105:
106: /** Gets the detail element. The detail element is intended for
107: * carrying application specific error information related to
108: * the SOAP Body.
109: *
110: * @return <code>detail</code> element of the SOAP fault
111: * @see javax.xml.soap.Detail
112: */
113: public Detail getDetail() {
114: return this.detail;
115: }
116: }
|