View Javadoc

1   /*
2    * Copyright 2006 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.soap;
18  
19  import javax.xml.namespace.QName;
20  
21  /**
22   * Interface that defines a specific version of the SOAP specification. Contains properties for elements that make up a
23   * soap envelope.
24   *
25   * @author Arjen Poutsma
26   * @see #SOAP_11
27   * @see #SOAP_12
28   * @since 1.0.0
29   */
30  public interface SoapVersion {
31  
32      /**
33       * Represents version 1.1 of the SOAP specification.
34       *
35       * @see <a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508/">SOAP 1.1 specification</a>
36       */
37      SoapVersion SOAP_11 = new SoapVersion() {
38  
39          private static final String ENVELOPE_NAMESPACE_URI = "http://schemas.xmlsoap.org/soap/envelope/";
40  
41          private static final String NEXT_ROLE_URI = "http://schemas.xmlsoap.org/soap/actor/next";
42  
43          private static final String CONTENT_TYPE = "text/xml";
44  
45          private QName ENVELOPE_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Envelope");
46  
47          private QName HEADER_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Header");
48  
49          private QName BODY_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Body");
50  
51          private QName FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Fault");
52  
53          private QName MUST_UNDERSTAND_ATTRIBUTE_NAME = new QName(ENVELOPE_NAMESPACE_URI, "mustUnderstand");
54  
55          private QName ACTOR_NAME = new QName(ENVELOPE_NAMESPACE_URI, "actor");
56  
57          private QName CLIENT_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Client");
58  
59          private QName SERVER_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Server");
60  
61          private QName MUST_UNDERSTAND_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "MustUnderstand");
62  
63          private QName VERSION_MISMATCH_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "VersionMismatch");
64  
65          public QName getBodyName() {
66              return BODY_NAME;
67          }
68  
69          public QName getEnvelopeName() {
70              return ENVELOPE_NAME;
71          }
72  
73          public String getEnvelopeNamespaceUri() {
74              return ENVELOPE_NAMESPACE_URI;
75          }
76  
77          public QName getFaultName() {
78              return FAULT_NAME;
79          }
80  
81          public QName getHeaderName() {
82              return HEADER_NAME;
83          }
84  
85          public String getNextActorOrRoleUri() {
86              return NEXT_ROLE_URI;
87          }
88  
89          public String getNoneActorOrRoleUri() {
90              return "";
91          }
92  
93          public QName getServerOrReceiverFaultName() {
94              return SERVER_FAULT_NAME;
95          }
96  
97          public String getUltimateReceiverRoleUri() {
98              return "";
99          }
100 
101         public QName getActorOrRoleName() {
102             return ACTOR_NAME;
103         }
104 
105         public QName getClientOrSenderFaultName() {
106             return CLIENT_FAULT_NAME;
107         }
108 
109         public String getContentType() {
110             return CONTENT_TYPE;
111         }
112 
113         public QName getMustUnderstandAttributeName() {
114             return MUST_UNDERSTAND_ATTRIBUTE_NAME;
115         }
116 
117         public QName getMustUnderstandFaultName() {
118             return MUST_UNDERSTAND_FAULT_NAME;
119         }
120 
121         public QName getVersionMismatchFaultName() {
122             return VERSION_MISMATCH_FAULT_NAME;
123         }
124 
125         public String toString() {
126             return "SOAP 1.1";
127         }
128     };
129 
130     /**
131      * Represents version 1.2 of the SOAP specification.
132      *
133      * @see <a href="http://www.w3.org/TR/soap12-part0/">SOAP 1.2 specification</a>
134      */
135     SoapVersion SOAP_12 = new SoapVersion() {
136 
137         private static final String ENVELOPE_NAMESPACE_URI = "http://www.w3.org/2003/05/soap-envelope";
138 
139         private static final String NEXT_ROLE_URI = ENVELOPE_NAMESPACE_URI + "/role/next";
140 
141         private static final String NONE_ROLE_URI = ENVELOPE_NAMESPACE_URI + "/role/none";
142 
143         private static final String ULTIMATE_RECEIVER_ROLE_URI = ENVELOPE_NAMESPACE_URI + "/role/ultimateReceiver";
144 
145         private static final String CONTENT_TYPE = "application/soap+xml";
146 
147         private QName ENVELOPE_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Envelope");
148 
149         private QName HEADER_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Header");
150 
151         private QName BODY_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Body");
152 
153         private QName FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Fault");
154 
155         private QName MUST_UNDERSTAND_ATTRIBUTE_NAME = new QName(ENVELOPE_NAMESPACE_URI, "mustUnderstand");
156 
157         private QName ROLE_NAME = new QName(ENVELOPE_NAMESPACE_URI, "role");
158 
159         private QName SENDER_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Sender");
160 
161         private QName RECEIVER_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "Receiver");
162 
163         private QName MUST_UNDERSTAND_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "MustUnderstand");
164 
165         private QName VERSION_MISMATCH_FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI, "VersionMismatch");
166 
167         public QName getBodyName() {
168             return BODY_NAME;
169         }
170 
171         public QName getEnvelopeName() {
172             return ENVELOPE_NAME;
173         }
174 
175         public String getEnvelopeNamespaceUri() {
176             return ENVELOPE_NAMESPACE_URI;
177         }
178 
179         public QName getFaultName() {
180             return FAULT_NAME;
181         }
182 
183         public QName getHeaderName() {
184             return HEADER_NAME;
185         }
186 
187         public String getNextActorOrRoleUri() {
188             return NEXT_ROLE_URI;
189         }
190 
191         public String getNoneActorOrRoleUri() {
192             return NONE_ROLE_URI;
193         }
194 
195         public QName getServerOrReceiverFaultName() {
196             return RECEIVER_FAULT_NAME;
197         }
198 
199         public String getUltimateReceiverRoleUri() {
200             return ULTIMATE_RECEIVER_ROLE_URI;
201         }
202 
203         public QName getActorOrRoleName() {
204             return ROLE_NAME;
205         }
206 
207         public QName getClientOrSenderFaultName() {
208             return SENDER_FAULT_NAME;
209         }
210 
211         public String getContentType() {
212             return CONTENT_TYPE;
213         }
214 
215         public QName getMustUnderstandAttributeName() {
216             return MUST_UNDERSTAND_ATTRIBUTE_NAME;
217         }
218 
219         public QName getMustUnderstandFaultName() {
220             return MUST_UNDERSTAND_FAULT_NAME;
221         }
222 
223         public QName getVersionMismatchFaultName() {
224             return VERSION_MISMATCH_FAULT_NAME;
225         }
226 
227         public String toString() {
228             return "SOAP 1.2";
229         }
230 
231     };
232 
233     /** Returns the qualified name for a SOAP body. */
234     QName getBodyName();
235 
236     /** Returns the <code>Content-Type</code> MIME header for a SOAP message. */
237     String getContentType();
238 
239     /** Returns the qualified name for a SOAP envelope. */
240     QName getEnvelopeName();
241 
242     /** Returns the namespace URI for the SOAP envelope namespace. */
243     String getEnvelopeNamespaceUri();
244 
245     /** Returns the qualified name for a SOAP fault. */
246     QName getFaultName();
247 
248     /** Returns the qualified name for a SOAP header. */
249     QName getHeaderName();
250 
251     /** Returns the qualified name of the SOAP <code>MustUnderstand</code> attribute. */
252     QName getMustUnderstandAttributeName();
253 
254     /**
255      * Returns the URI indicating that a header element is intended for the next SOAP application that processes the
256      * message.
257      */
258     String getNextActorOrRoleUri();
259 
260     /** Returns the URI indicating that a header element should never be directly processed. */
261     String getNoneActorOrRoleUri();
262 
263     /** Returns the qualified name of the <code>MustUnderstand</code> SOAP Fault value. */
264     QName getMustUnderstandFaultName();
265 
266     /** Returns the qualified name of the Receiver/Server SOAP Fault value. */
267     QName getServerOrReceiverFaultName();
268 
269     /** Returns the qualified name of the <code>VersionMismatch</code> SOAP Fault value. */
270     QName getVersionMismatchFaultName();
271 
272     /** Returns the qualified name of the SOAP <code>actor</code>/<code>role</code> attribute. */
273     QName getActorOrRoleName();
274 
275     /** Returns the qualified name of the Sender/Client SOAP Fault value. */
276     QName getClientOrSenderFaultName();
277 
278     /**
279      * Returns the URI indicating that a header element should only be processed by nodes acting as the ultimate
280      * receiver of a message.
281      */
282     String getUltimateReceiverRoleUri();
283 }