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