001: /*
002: * Copyright 2006 the original author or authors.
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:
017: package org.springframework.ws.soap;
018:
019: import javax.xml.namespace.QName;
020:
021: /**
022: * Interface that defines a specific version of the SOAP specification. Contains properties for elements that make up a
023: * soap envelope.
024: *
025: * @author Arjen Poutsma
026: * @see #SOAP_11
027: * @see #SOAP_12
028: * @since 1.0.0
029: */
030: public interface SoapVersion {
031:
032: /**
033: * Represents version 1.1 of the SOAP specification.
034: *
035: * @see <a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508/">SOAP 1.1 specification</a>
036: */
037: SoapVersion SOAP_11 = new SoapVersion() {
038:
039: private static final String ENVELOPE_NAMESPACE_URI = "http://schemas.xmlsoap.org/soap/envelope/";
040:
041: private static final String NEXT_ROLE_URI = "http://schemas.xmlsoap.org/soap/actor/next";
042:
043: private static final String CONTENT_TYPE = "text/xml";
044:
045: private QName ENVELOPE_NAME = new QName(ENVELOPE_NAMESPACE_URI,
046: "Envelope");
047:
048: private QName HEADER_NAME = new QName(ENVELOPE_NAMESPACE_URI,
049: "Header");
050:
051: private QName BODY_NAME = new QName(ENVELOPE_NAMESPACE_URI,
052: "Body");
053:
054: private QName FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI,
055: "Fault");
056:
057: private QName MUST_UNDERSTAND_ATTRIBUTE_NAME = new QName(
058: ENVELOPE_NAMESPACE_URI, "mustUnderstand");
059:
060: private QName ACTOR_NAME = new QName(ENVELOPE_NAMESPACE_URI,
061: "actor");
062:
063: private QName CLIENT_FAULT_NAME = new QName(
064: ENVELOPE_NAMESPACE_URI, "Client");
065:
066: private QName SERVER_FAULT_NAME = new QName(
067: ENVELOPE_NAMESPACE_URI, "Server");
068:
069: private QName MUST_UNDERSTAND_FAULT_NAME = new QName(
070: ENVELOPE_NAMESPACE_URI, "MustUnderstand");
071:
072: private QName VERSION_MISMATCH_FAULT_NAME = new QName(
073: ENVELOPE_NAMESPACE_URI, "VersionMismatch");
074:
075: public QName getBodyName() {
076: return BODY_NAME;
077: }
078:
079: public QName getEnvelopeName() {
080: return ENVELOPE_NAME;
081: }
082:
083: public String getEnvelopeNamespaceUri() {
084: return ENVELOPE_NAMESPACE_URI;
085: }
086:
087: public QName getFaultName() {
088: return FAULT_NAME;
089: }
090:
091: public QName getHeaderName() {
092: return HEADER_NAME;
093: }
094:
095: public String getNextActorOrRoleUri() {
096: return NEXT_ROLE_URI;
097: }
098:
099: public String getNoneActorOrRoleUri() {
100: return "";
101: }
102:
103: public QName getServerOrReceiverFaultName() {
104: return SERVER_FAULT_NAME;
105: }
106:
107: public String getUltimateReceiverRoleUri() {
108: return "";
109: }
110:
111: public QName getActorOrRoleName() {
112: return ACTOR_NAME;
113: }
114:
115: public QName getClientOrSenderFaultName() {
116: return CLIENT_FAULT_NAME;
117: }
118:
119: public String getContentType() {
120: return CONTENT_TYPE;
121: }
122:
123: public QName getMustUnderstandAttributeName() {
124: return MUST_UNDERSTAND_ATTRIBUTE_NAME;
125: }
126:
127: public QName getMustUnderstandFaultName() {
128: return MUST_UNDERSTAND_FAULT_NAME;
129: }
130:
131: public QName getVersionMismatchFaultName() {
132: return VERSION_MISMATCH_FAULT_NAME;
133: }
134:
135: public String toString() {
136: return "SOAP 1.1";
137: }
138: };
139:
140: /**
141: * Represents version 1.2 of the SOAP specification.
142: *
143: * @see <a href="http://www.w3.org/TR/soap12-part0/">SOAP 1.2 specification</a>
144: */
145: SoapVersion SOAP_12 = new SoapVersion() {
146:
147: private static final String ENVELOPE_NAMESPACE_URI = "http://www.w3.org/2003/05/soap-envelope";
148:
149: private static final String NEXT_ROLE_URI = ENVELOPE_NAMESPACE_URI
150: + "/role/next";
151:
152: private static final String NONE_ROLE_URI = ENVELOPE_NAMESPACE_URI
153: + "/role/none";
154:
155: private static final String ULTIMATE_RECEIVER_ROLE_URI = ENVELOPE_NAMESPACE_URI
156: + "/role/ultimateReceiver";
157:
158: private static final String CONTENT_TYPE = "application/soap+xml";
159:
160: private QName ENVELOPE_NAME = new QName(ENVELOPE_NAMESPACE_URI,
161: "Envelope");
162:
163: private QName HEADER_NAME = new QName(ENVELOPE_NAMESPACE_URI,
164: "Header");
165:
166: private QName BODY_NAME = new QName(ENVELOPE_NAMESPACE_URI,
167: "Body");
168:
169: private QName FAULT_NAME = new QName(ENVELOPE_NAMESPACE_URI,
170: "Fault");
171:
172: private QName MUST_UNDERSTAND_ATTRIBUTE_NAME = new QName(
173: ENVELOPE_NAMESPACE_URI, "mustUnderstand");
174:
175: private QName ROLE_NAME = new QName(ENVELOPE_NAMESPACE_URI,
176: "role");
177:
178: private QName SENDER_FAULT_NAME = new QName(
179: ENVELOPE_NAMESPACE_URI, "Sender");
180:
181: private QName RECEIVER_FAULT_NAME = new QName(
182: ENVELOPE_NAMESPACE_URI, "Receiver");
183:
184: private QName MUST_UNDERSTAND_FAULT_NAME = new QName(
185: ENVELOPE_NAMESPACE_URI, "MustUnderstand");
186:
187: private QName VERSION_MISMATCH_FAULT_NAME = new QName(
188: ENVELOPE_NAMESPACE_URI, "VersionMismatch");
189:
190: public QName getBodyName() {
191: return BODY_NAME;
192: }
193:
194: public QName getEnvelopeName() {
195: return ENVELOPE_NAME;
196: }
197:
198: public String getEnvelopeNamespaceUri() {
199: return ENVELOPE_NAMESPACE_URI;
200: }
201:
202: public QName getFaultName() {
203: return FAULT_NAME;
204: }
205:
206: public QName getHeaderName() {
207: return HEADER_NAME;
208: }
209:
210: public String getNextActorOrRoleUri() {
211: return NEXT_ROLE_URI;
212: }
213:
214: public String getNoneActorOrRoleUri() {
215: return NONE_ROLE_URI;
216: }
217:
218: public QName getServerOrReceiverFaultName() {
219: return RECEIVER_FAULT_NAME;
220: }
221:
222: public String getUltimateReceiverRoleUri() {
223: return ULTIMATE_RECEIVER_ROLE_URI;
224: }
225:
226: public QName getActorOrRoleName() {
227: return ROLE_NAME;
228: }
229:
230: public QName getClientOrSenderFaultName() {
231: return SENDER_FAULT_NAME;
232: }
233:
234: public String getContentType() {
235: return CONTENT_TYPE;
236: }
237:
238: public QName getMustUnderstandAttributeName() {
239: return MUST_UNDERSTAND_ATTRIBUTE_NAME;
240: }
241:
242: public QName getMustUnderstandFaultName() {
243: return MUST_UNDERSTAND_FAULT_NAME;
244: }
245:
246: public QName getVersionMismatchFaultName() {
247: return VERSION_MISMATCH_FAULT_NAME;
248: }
249:
250: public String toString() {
251: return "SOAP 1.2";
252: }
253:
254: };
255:
256: /** Returns the qualified name for a SOAP body. */
257: QName getBodyName();
258:
259: /** Returns the <code>Content-Type</code> MIME header for a SOAP message. */
260: String getContentType();
261:
262: /** Returns the qualified name for a SOAP envelope. */
263: QName getEnvelopeName();
264:
265: /** Returns the namespace URI for the SOAP envelope namespace. */
266: String getEnvelopeNamespaceUri();
267:
268: /** Returns the qualified name for a SOAP fault. */
269: QName getFaultName();
270:
271: /** Returns the qualified name for a SOAP header. */
272: QName getHeaderName();
273:
274: /** Returns the qualified name of the SOAP <code>MustUnderstand</code> attribute. */
275: QName getMustUnderstandAttributeName();
276:
277: /**
278: * Returns the URI indicating that a header element is intended for the next SOAP application that processes the
279: * message.
280: */
281: String getNextActorOrRoleUri();
282:
283: /** Returns the URI indicating that a header element should never be directly processed. */
284: String getNoneActorOrRoleUri();
285:
286: /** Returns the qualified name of the <code>MustUnderstand</code> SOAP Fault value. */
287: QName getMustUnderstandFaultName();
288:
289: /** Returns the qualified name of the Receiver/Server SOAP Fault value. */
290: QName getServerOrReceiverFaultName();
291:
292: /** Returns the qualified name of the <code>VersionMismatch</code> SOAP Fault value. */
293: QName getVersionMismatchFaultName();
294:
295: /** Returns the qualified name of the SOAP <code>actor</code>/<code>role</code> attribute. */
296: QName getActorOrRoleName();
297:
298: /** Returns the qualified name of the Sender/Client SOAP Fault value. */
299: QName getClientOrSenderFaultName();
300:
301: /**
302: * Returns the URI indicating that a header element should only be processed by nodes acting as the ultimate
303: * receiver of a message.
304: */
305: String getUltimateReceiverRoleUri();
306: }
|