001 /* 002 * Copyright 2001-2004 The Apache Software Foundation. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package javax.xml.rpc.soap; 017 018 import javax.xml.namespace.QName; 019 import javax.xml.soap.Detail; 020 021 /** 022 * The <code>SOAPFaultException</code> exception represents a 023 * SOAP fault. 024 * <p> 025 * The message part in the SOAP fault maps to the contents of 026 * <code>faultdetail</code> element accessible through the 027 * <code>getDetail</code> method on the <code>SOAPFaultException</code>. 028 * The method <code>createDetail</code> on the 029 * <code>javax.xml.soap.SOAPFactory</code> creates an instance 030 * of the <code>javax.xml.soap.Detail</code>. 031 * <p> 032 * The <code>faultstring</code> provides a human-readable 033 * description of the SOAP fault. The <code>faultcode</code> 034 * element provides an algorithmic mapping of the SOAP fault. 035 * <p> 036 * Refer to SOAP 1.1 and WSDL 1.1 specifications for more 037 * details of the SOAP faults. 038 * 039 * @version 1.0 040 */ 041 public class SOAPFaultException extends RuntimeException { 042 043 /** 044 * Constructor for SOAPFaultException. 045 * 046 * @param faultcode <code>QName</code> for the SOAP faultcode 047 * @param faultstring <code>faultstring</code> element of SOAP fault 048 * @param faultactor <code>faultactor</code> element of SOAP fault 049 * @param detail <code>faultdetail</code> element of SOAP fault 050 */ 051 public SOAPFaultException(QName faultcode, String faultstring, 052 String faultactor, Detail detail) { 053 054 super(faultstring); 055 056 this.faultcode = faultcode; 057 this.faultstring = faultstring; 058 this.faultactor = faultactor; 059 this.detail = detail; 060 } 061 062 /** 063 * Gets the <code>faultcode</code> element. The <code>faultcode</code> element provides an algorithmic 064 * mechanism for identifying the fault. SOAP defines a small set of SOAP fault codes covering 065 * basic SOAP faults. 066 * @return QName of the faultcode element 067 */ 068 public QName getFaultCode() { 069 return faultcode; 070 } 071 072 /** 073 * Gets the <code>faultstring</code> element. The faultstring provides a human-readable description of 074 * the SOAP fault and is not intended for algorithmic processing. 075 * @return <code>faultstring</code> element of the SOAP fault 076 */ 077 public String getFaultString() { 078 return faultstring; 079 } 080 081 /** 082 * Gets the <code>faultactor</code> element. The <code>faultactor</code> 083 * element provides information about which SOAP node on the SOAP message 084 * path caused the fault to happen. It indicates the source of the fault. 085 * 086 * @return <code>faultactor</code> element of the SOAP fault 087 */ 088 public String getFaultActor() { 089 return faultactor; 090 } 091 092 /** 093 * Gets the detail element. The detail element is intended for carrying 094 * application specific error information related to the SOAP Body. 095 * 096 * @return <code>detail</code> element of the SOAP fault 097 */ 098 public Detail getDetail() { 099 return detail; 100 } 101 102 /** Qualified name of the faultcode. */ 103 private QName faultcode; 104 105 /** The faultstring element of the SOAP fault. */ 106 private String faultstring; 107 108 /** Faultactor element of the SOAP fault. */ 109 private String faultactor; 110 111 /** Detail element of the SOAP fault. */ 112 private Detail detail; 113 }