|
1 /* |
|
2 * Copyright (c) 2005, 2015, 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 /** |
|
27 * Provides the API for creating and building SOAP messages. This package |
|
28 * is defined in the <i>SOAP with Attachments API for Java<sup><font size="-2">TM</font></sup> |
|
29 * (SAAJ) 1.4</i> specification. |
|
30 * |
|
31 * <p> The API in the <code>javax.xml.soap</code> package allows you to do the following: |
|
32 * |
|
33 * <ul> |
|
34 * <li>create a point-to-point connection to a specified endpoint |
|
35 * <li>create a SOAP message |
|
36 * <li>create an XML fragment |
|
37 * <li>add content to the header of a SOAP message |
|
38 * <li>add content to the body of a SOAP message |
|
39 * <li>create attachment parts and add content to them |
|
40 * <li>access/add/modify parts of a SOAP message |
|
41 * <li>create/add/modify SOAP fault information |
|
42 * <li>extract content from a SOAP message |
|
43 * <li>send a SOAP request-response message |
|
44 * </ul> |
|
45 * |
|
46 * <p> |
|
47 * In addition the APIs in the <code>javax.xml.soap</code> package extend |
|
48 * their counterparts in the <code>org.w3c.dom</code> package. This means that |
|
49 * the <code>SOAPPart</code> of a <code>SOAPMessage</code> is also a DOM Level |
|
50 * 2 <code>Document</code>, and can be manipulated as such by applications, |
|
51 * tools and libraries that use DOM (see http://www.w3.org/DOM/ for more information). |
|
52 * It is important to note that, while it is possible to use DOM APIs to add |
|
53 * ordinary DOM nodes to a SAAJ tree, the SAAJ APIs are still required to return |
|
54 * SAAJ types when examining or manipulating the tree. In order to accomplish |
|
55 * this the SAAJ APIs (specifically {@link javax.xml.soap.SOAPElement#getChildElements()}) |
|
56 * are allowed to silently replace objects that are incorrectly typed relative |
|
57 * to SAAJ requirements with equivalent objects of the required type. These |
|
58 * replacements must never cause the logical structure of the tree to change, |
|
59 * so from the perspective of the DOM APIs the tree will remain unchanged. However, |
|
60 * the physical composition of the tree will have changed so that references |
|
61 * to the nodes that were replaced will refer to nodes that are no longer a |
|
62 * part of the tree. The SAAJ APIs are not allowed to make these replacements |
|
63 * if they are not required so the replacement objects will never subsequently |
|
64 * be silently replaced by future calls to the SAAJ API. |
|
65 * <p> |
|
66 * What this means in practical terms is that an application that starts to use |
|
67 * SAAJ APIs on a tree after manipulating it using DOM APIs must assume that the |
|
68 * tree has been translated into an all SAAJ tree and that any references to objects |
|
69 * within the tree that were obtained using DOM APIs are no longer valid. Switching |
|
70 * from SAAJ APIs to DOM APIs is not allowed to cause invalid references and |
|
71 * neither is using SAAJ APIs exclusively. It is only switching from using DOM |
|
72 * APIs on a particular SAAJ tree to using SAAJ APIs that causes the risk of |
|
73 * invalid references. |
|
74 * |
|
75 * <h3>Discovery of SAAJ implementation</h3> |
|
76 * <p> |
|
77 * There are several factories defined in the SAAJ API to discover and load specific implementation: |
|
78 * |
|
79 * <ul> |
|
80 * <li>{@link javax.xml.soap.SOAPFactory} |
|
81 * <li>{@link javax.xml.soap.MessageFactory} |
|
82 * <li>{@link javax.xml.soap.SOAPConnectionFactory} |
|
83 * <li>{@link javax.xml.soap.SAAJMetaFactory} |
|
84 * </ul> |
|
85 * |
|
86 * First three define {@code newInstance()} method which uses a common lookup procedure to determine |
|
87 * the implementation class: |
|
88 * |
|
89 * <ul> |
|
90 * <li>Checks if a system property with the same name as the factory class is set (e.g. |
|
91 * {@code javax.xml.soap.SOAPFactory}). If such property exists then its value is assumed to be the fully qualified |
|
92 * name of the implementation class. This phase of the look up enables per-JVM override of the SAAJ implementation. |
|
93 * <li>Use the configuration file "jaxm.properties". The file is in standard |
|
94 * {@link java.util.Properties} format and typically located in the |
|
95 * {@code conf} directory of the Java installation. It contains the fully qualified |
|
96 * name of the implementation class with the key being the system property |
|
97 * defined above. |
|
98 * <li> Use the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, |
|
99 * to attempt to locate and load an implementation of the service using the {@linkplain |
|
100 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}. |
|
101 * <li> Finally, if all the steps above fail, {@link javax.xml.soap.SAAJMetaFactory} instance is used |
|
102 * to locate specific implementation (for {@link javax.xml.soap.MessageFactory} and {@link javax.xml.soap.SOAPFactory}) |
|
103 * or platform default implementation is used ({@link javax.xml.soap.SOAPConnectionFactory}). |
|
104 * Whenever {@link javax.xml.soap.SAAJMetaFactory} is used, its lookup procedure to get actual instance is performed. |
|
105 * </ul> |
|
106 */ |
|
107 package javax.xml.soap; |