File: SOAPBody.java

package info (click to toggle)
libjboss-web-services-java 0.0%2Bsvn5660-2
  • links: PTS, VCS
  • area: contrib
  • in suites: lenny
  • size: 7,268 kB
  • ctags: 12,475
  • sloc: java: 79,207; xml: 38; makefile: 19; sh: 15
file content (170 lines) | stat: -rwxr-xr-x 8,376 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package javax.xml.soap;

import java.util.Locale;

import javax.xml.namespace.QName;

import org.w3c.dom.Document;

/** An object that represents the contents of the SOAP body element in a SOAP
 * message. A SOAP body element consists of XML data that affects the way the
 * application-specific content is processed.
 * 
 * A SOAPBody object contains SOAPBodyElement objects, which have the content
 * for the SOAP body. A SOAPFault object, which carries status and/or error
 * information, is an example of a SOAPBodyElement object.

 * @author Scott.Stark@jboss.org
 * @version $Revision: 2897 $
 */
public interface SOAPBody extends SOAPElement
{
   /** Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object.
    *
    * @param name a Name object with the name for the new SOAPBodyElement object
    * @return the new SOAPBodyElement object
    * @throws SOAPException if a SOAP error occurs
    */
   public abstract SOAPBodyElement addBodyElement(Name name) throws SOAPException;

   /**
    * Creates a new SOAPBodyElement object with the specified QName and adds it to this SOAPBody object.
    * @param qname a QName object with the qname for the new SOAPBodyElement object
    * @return the new SOAPBodyElement object
    * @throws SOAPException if a SOAP error occurs
    * @since SAAJ 1.3
    */
   public abstract SOAPBodyElement addBodyElement(QName qname) throws SOAPException;

   /** Adds the root node of the DOM Document to this SOAPBody object.
    *
    * Calling this method invalidates the document parameter.
    * The client application should discard all references to this Document and its contents upon calling addDocument.
    * The behavior of an application that continues to use such references is undefined.
    *
    * @param doc  the Document object whose root node will be added to this SOAPBody.
    * @return the SOAPBodyElement that represents the root node that was added.
    * @throws SOAPException  if the Document cannot be added
    */
   public abstract SOAPBodyElement addDocument(Document doc) throws SOAPException;

   /** Creates a new SOAPFault object and adds it to this SOAPBody object.
    *
    * The new SOAPFault will have default values set for the mandatory child elements faultcode and faultstring.
    * A SOAPBody may contain at most one SOAPFault child element
    *
    * @return the new SOAPFault object
    * @throws SOAPException if there is a SOAP error
    */
   public abstract SOAPFault addFault() throws SOAPException;

   /** Creates a new SOAPFault object and adds it to this SOAPBody object.
    *
    * The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring
    * set to faultString.
    *
    * A SOAPBody may contain at most one SOAPFault child element
    *
    * @param faultCode a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName
    * @param faultString a String giving an explanation of the fault
    * @return the new SOAPFault object
    * @throws SOAPException if there is a SOAP error
    */
   public abstract SOAPFault addFault(Name faultCode, String faultString) throws SOAPException;
   
   /**
    * Creates a new SOAPFault object and adds it to this SOAPBody  object. The type of the SOAPFault  will be a SOAP 1.1 or a SOAP 1.2 SOAPFault 
    * depending on the protocol specified while creating the MessageFactory  instance.
    * 
    * For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is the value 
    * of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element and the 
    * faultString parameter is the value of the faultstring element.
    * 
    * In case of a SOAP 1.2 fault, the default value for the mandatory xml:lang attribute on the Fault/Reason/Text element will be 
    * set to java.util.Locale.getDefault()
    * 
    * A SOAPBody may contain at most one SOAPFault child element
    *  
    * @param faultCode a QName object giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in use
    * @param faultString a String giving an explanation of the fault
    * @throws SOAPException if there is a SOAP error
    * @since SAAJ 1.3
    */
   public abstract SOAPFault addFault(QName faultCode, String faultString) throws SOAPException;

   /** Creates a new SOAPFault object and adds it to this SOAPBody object.
    *
    * The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring
    * set to faultString and localized to locale.
    *
    * A SOAPBody may contain at most one SOAPFault child element
    *
    * @param faultCode a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName
    * @param faultString a String giving an explanation of the fault
    * @param locale a Locale object indicating the native language of the faultString
    * @return the new SOAPFault object
    * @throws SOAPException if there is a SOAP error
    */
   public abstract SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;

   /**
    * Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 
    * SOAPFault depending on the protocol specified while creating the MessageFactory instance.
    * 
    * For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element and the faultString parameter is 
    * the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value of the faultcode element 
    * and the faultString parameter is the value of the faultstring element.
    * 
    * A SOAPBody may contain at most one SOAPFault child element.
    *  
    * @param faultCode a QName object giving the fault code to be set; must be one of the fault codes defined in the version of SOAP specification in use
    * @param faultString a String giving an explanation of the fault
    * @param locale a Locale object indicating the native language of the faultString
    * @return the new SOAPFault object
    * @throws SOAPException if there is a SOAP error
    * @since SAAJ 1.3
    */
   public abstract SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException;
   
   /** Returns the SOAPFault object in this SOAPBody  object.
    *
    * @return the SOAPFault object in this SOAPBody  object
    */
   public abstract SOAPFault getFault();

   /** Indicates whether a SOAPFault object exists in this SOAPBody object.
    *
    * @return true if a SOAPFault object exists in this SOAPBody object; false  otherwise
    */
   public abstract boolean hasFault();
   
   /**
    * Creates a new DOM Document and sets the first child of this SOAPBody as it's document element. 
    * The child SOAPElement is removed as part of the process.
    * @return the Document representation of the SOAPBody content.
    * @throws SOAPException if there is not exactly one child SOAPElement of the  SOAPBody.
    * @since SAAJ 1.3
    */
   public Document extractContentAsDocument() throws SOAPException;   
}