View Javadoc
1   /*
2    * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package javax.xml.soap;
27  
28  import java.util.Iterator;
29  
30  import javax.xml.namespace.QName;
31  
32  /**
33   * A container for <code>DetailEntry</code> objects. <code>DetailEntry</code>
34   * objects give detailed error information that is application-specific and
35   * related to the <code>SOAPBody</code> object that contains it.
36   *<P>
37   * A <code>Detail</code> object, which is part of a <code>SOAPFault</code>
38   * object, can be retrieved using the method <code>SOAPFault.getDetail</code>.
39   * The <code>Detail</code> interface provides two methods. One creates a new
40   * <code>DetailEntry</code> object and also automatically adds it to
41   * the <code>Detail</code> object. The second method gets a list of the
42   * <code>DetailEntry</code> objects contained in a <code>Detail</code>
43   * object.
44   * <P>
45   * The following code fragment, in which <i>sf</i> is a <code>SOAPFault</code>
46   * object, gets its <code>Detail</code> object (<i>d</i>), adds a new
47   * <code>DetailEntry</code> object to <i>d</i>, and then gets a list of all the
48   * <code>DetailEntry</code> objects in <i>d</i>. The code also creates a
49   * <code>Name</code> object to pass to the method <code>addDetailEntry</code>.
50   * The variable <i>se</i>, used to create the <code>Name</code> object,
51   * is a <code>SOAPEnvelope</code> object.
52   * <PRE>
53   *    Detail d = sf.getDetail();
54   *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
55   *                                "http://www.wombat.org/trader");
56   *    d.addDetailEntry(name);
57   *    Iterator it = d.getDetailEntries();
58   * </PRE>
59   */
60  public interface Detail extends SOAPFaultElement {
61  
62      /**
63       * Creates a new <code>DetailEntry</code> object with the given
64       * name and adds it to this <code>Detail</code> object.
65       *
66       * @param name a <code>Name</code> object identifying the
67       *         new <code>DetailEntry</code> object
68       *
69       * @exception SOAPException thrown when there is a problem in adding a
70       * DetailEntry object to this Detail object.
71       *
72       * @see Detail#addDetailEntry(QName qname)
73       */
74      public DetailEntry addDetailEntry(Name name) throws SOAPException;
75  
76      /**
77       * Creates a new <code>DetailEntry</code> object with the given
78       * QName and adds it to this <code>Detail</code> object. This method
79       * is the preferred over the one using Name.
80       *
81       * @param qname a <code>QName</code> object identifying the
82       *         new <code>DetailEntry</code> object
83       *
84       * @exception SOAPException thrown when there is a problem in adding a
85       * DetailEntry object to this Detail object.
86       *
87       * @see Detail#addDetailEntry(Name name)
88       * @since SAAJ 1.3
89       */
90      public DetailEntry addDetailEntry(QName qname) throws SOAPException;
91  
92      /**
93       * Gets an Iterator over all of the <code>DetailEntry</code>s in this <code>Detail</code> object.
94       *
95       * @return an <code>Iterator</code> object over the <code>DetailEntry</code>
96       *             objects in this <code>Detail</code> object
97       */
98      public Iterator getDetailEntries();
99  }