[jboss-cvs] JBossAS SVN: r104892 - in projects/specs/trunk: jboss-saaj-api_1.3_spec and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 17 21:16:45 EDT 2010
Author: smcgowan at redhat.com
Date: 2010-05-17 21:16:44 -0400 (Mon, 17 May 2010)
New Revision: 104892
Added:
projects/specs/trunk/jboss-saaj-api_1.3_spec/
projects/specs/trunk/jboss-saaj-api_1.3_spec/pom.xml
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/AttachmentPart.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Detail.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/DetailEntry.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/FactoryFinder.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MessageFactory.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeader.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeaders.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Name.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Node.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJMetaFactory.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJResult.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBody.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBodyElement.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnection.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnectionFactory.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConstants.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElement.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElementFactory.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPEnvelope.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPException.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFactory.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFault.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFaultElement.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeader.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeaderElement.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPMessage.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPPart.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Text.java
projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/package.html
Log:
JBEE-31 - add SAAJ 1.3 APIs
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/pom.xml
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/pom.xml (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/pom.xml 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-specs-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.spec.javax.xml.soap</groupId>
+ <artifactId>jboss-saaj-api_1.3_spec</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>SOAP with Attachments API for Java 1.3</name>
+ <description>The SOAP with Attachments API for Java Version 1.3 classes</description>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/specs/trunk/jboss-saaj-api_1.3_spec</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/specs/trunk/jboss-saaj-api_1.3_spec</developerConnection>
+ <url>http://fisheye.jboss.org/browse/JBossAS/projects/specs/trunk/jboss-saaj-api_1.3_spec</url>
+ </scm>
+
+</project>
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/AttachmentPart.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/AttachmentPart.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/AttachmentPart.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,528 @@
+/*
+ * $Id: AttachmentPart.java,v 1.13 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+
+/**
+ * A single attachment to a <code>SOAPMessage</code> object. A <code>SOAPMessage</code>
+ * object may contain zero, one, or many <code>AttachmentPart</code> objects.
+ * Each <code>AttachmentPart</code> object consists of two parts,
+ * application-specific content and associated MIME headers. The
+ * MIME headers consists of name/value pairs that can be used to
+ * identify and describe the content.
+ * <p>
+ * An <code>AttachmentPart</code> object must conform to certain standards.
+ * <OL>
+ * <LI>It must conform to <a href="http://www.ietf.org/rfc/rfc2045.txt">
+ * MIME [RFC2045] standards</a>
+ * <LI>It MUST contain content
+ * <LI>The header portion MUST include the following header:
+ * <UL>
+ * <LI><code>Content-Type</code><br>
+ * This header identifies the type of data in the content of an
+ * <code>AttachmentPart</code> object and MUST conform to [RFC2045].
+ * The following is an example of a Content-Type header:
+ * <PRE>
+ * Content-Type: application/xml
+ * </PRE>
+ * The following line of code, in which <code>ap</code> is an
+ * <code>AttachmentPart</code> object, sets the header shown in
+ * the previous example.
+ * <PRE>
+ * ap.setMimeHeader("Content-Type", "application/xml");
+ * </PRE>
+ * <p>
+ * </UL>
+ * </OL>
+ * <p>
+ * There are no restrictions on the content portion of an <code>
+ * AttachmentPart</code> object. The content may be anything from a
+ * simple plain text object to a complex XML document or image file.
+ *
+ * <p>
+ * An <code>AttachmentPart</code> object is created with the method
+ * <code>SOAPMessage.createAttachmentPart</code>. After setting its MIME headers,
+ * the <code>AttachmentPart</code> object is added to the message
+ * that created it with the method <code>SOAPMessage.addAttachmentPart</code>.
+ *
+ * <p>
+ * The following code fragment, in which <code>m</code> is a
+ * <code>SOAPMessage</code> object and <code>contentStringl</code> is a
+ * <code>String</code>, creates an instance of <code>AttachmentPart</code>,
+ * sets the <code>AttachmentPart</code> object with some content and
+ * header information, and adds the <code>AttachmentPart</code> object to
+ * the <code>SOAPMessage</code> object.
+ * <PRE>
+ * AttachmentPart ap1 = m.createAttachmentPart();
+ * ap1.setContent(contentString1, "text/plain");
+ * m.addAttachmentPart(ap1);
+ * </PRE>
+ *
+ *
+ * <p>
+ * The following code fragment creates and adds a second
+ * <code>AttachmentPart</code> instance to the same message. <code>jpegData</code>
+ * is a binary byte buffer representing the jpeg file.
+ * <PRE>
+ * AttachmentPart ap2 = m.createAttachmentPart();
+ * byte[] jpegData = ...;
+ * ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg");
+ * m.addAttachmentPart(ap2);
+ * </PRE>
+ * <p>
+ * The <code>getContent</code> method retrieves the contents and header from
+ * an <code>AttachmentPart</code> object. Depending on the
+ * <code>DataContentHandler</code> objects present, the returned
+ * <code>Object</code> can either be a typed Java object corresponding
+ * to the MIME type or an <code>InputStream</code> object that contains the
+ * content as bytes.
+ * <PRE>
+ * String content1 = ap1.getContent();
+ * java.io.InputStream content2 = ap2.getContent();
+ * </PRE>
+ *
+ * The method <code>clearContent</code> removes all the content from an
+ * <code>AttachmentPart</code> object but does not affect its header information.
+ * <PRE>
+ * ap1.clearContent();
+ * </PRE>
+ */
+
+public abstract class AttachmentPart {
+ /**
+ * Returns the number of bytes in this <code>AttachmentPart</code>
+ * object.
+ *
+ * @return the size of this <code>AttachmentPart</code> object in bytes
+ * or -1 if the size cannot be determined
+ * @exception SOAPException if the content of this attachment is
+ * corrupted of if there was an exception while trying
+ * to determine the size.
+ */
+ public abstract int getSize() throws SOAPException;
+
+ /**
+ * Clears out the content of this <code>AttachmentPart</code> object.
+ * The MIME header portion is left untouched.
+ */
+ public abstract void clearContent();
+
+ /**
+ * Gets the content of this <code>AttachmentPart</code> object as a Java
+ * object. The type of the returned Java object depends on (1) the
+ * <code>DataContentHandler</code> object that is used to interpret the bytes
+ * and (2) the <code>Content-Type</code> given in the header.
+ * <p>
+ * For the MIME content types "text/plain", "text/html" and "text/xml", the
+ * <code>DataContentHandler</code> object does the conversions to and
+ * from the Java types corresponding to the MIME types.
+ * For other MIME types,the <code>DataContentHandler</code> object
+ * can return an <code>InputStream</code> object that contains the content data
+ * as raw bytes.
+ * <p>
+ * A SAAJ-compliant implementation must, as a minimum, return a
+ * <code>java.lang.String</code> object corresponding to any content
+ * stream with a <code>Content-Type</code> value of
+ * <code>text/plain</code>, a
+ * <code>javax.xml.transform.stream.StreamSource</code> object corresponding to a
+ * content stream with a <code>Content-Type</code> value of
+ * <code>text/xml</code>, a <code>java.awt.Image</code> object
+ * corresponding to a content stream with a
+ * <code>Content-Type</code> value of <code>image/gif</code> or
+ * <code>image/jpeg</code>. For those content types that an
+ * installed <code>DataContentHandler</code> object does not understand, the
+ * <code>DataContentHandler</code> object is required to return a
+ * <code>java.io.InputStream</code> object with the raw bytes.
+ *
+ * @return a Java object with the content of this <code>AttachmentPart</code>
+ * object
+ *
+ * @exception SOAPException if there is no content set into this
+ * <code>AttachmentPart</code> object or if there was a data
+ * transformation error
+ */
+ public abstract Object getContent() throws SOAPException;
+
+ /**
+ * Gets the content of this <code>AttachmentPart</code> object as an
+ * InputStream as if a call had been made to <code>getContent</code> and no
+ * <code>DataContentHandler</code> had been registered for the
+ * <code>content-type</code> of this <code>AttachmentPart</code>.
+ *<p>
+ * Note that reading from the returned InputStream would result in consuming
+ * the data in the stream. It is the responsibility of the caller to reset
+ * the InputStream appropriately before calling a Subsequent API. If a copy
+ * of the raw attachment content is required then the {@link #getRawContentBytes} API
+ * should be used instead.
+ *
+ * @return an <code>InputStream</code> from which the raw data contained by
+ * the <code>AttachmentPart</code> can be accessed.
+ *
+ * @throws SOAPException if there is no content set into this
+ * <code>AttachmentPart</code> object or if there was a data
+ * transformation error.
+ *
+ * @since SAAJ 1.3
+ * @see #getRawContentBytes
+ */
+ public abstract InputStream getRawContent() throws SOAPException;
+
+ /**
+ * Gets the content of this <code>AttachmentPart</code> object as a
+ * byte[] array as if a call had been made to <code>getContent</code> and no
+ * <code>DataContentHandler</code> had been registered for the
+ * <code>content-type</code> of this <code>AttachmentPart</code>.
+ *
+ * @return a <code>byte[]</code> array containing the raw data of the
+ * <code>AttachmentPart</code>.
+ *
+ * @throws SOAPException if there is no content set into this
+ * <code>AttachmentPart</code> object or if there was a data
+ * transformation error.
+ *
+ * @since SAAJ 1.3
+ */
+ public abstract byte[] getRawContentBytes() throws SOAPException;
+
+ /**
+ * Returns an <code>InputStream</code> which can be used to obtain the
+ * content of <code>AttachmentPart</code> as Base64 encoded
+ * character data, this method would base64 encode the raw bytes
+ * of the attachment and return.
+ *
+ * @return an <code>InputStream</code> from which the Base64 encoded
+ * <code>AttachmentPart</code> can be read.
+ *
+ * @throws SOAPException if there is no content set into this
+ * <code>AttachmentPart</code> object or if there was a data
+ * transformation error.
+ *
+ * @since SAAJ 1.3
+ */
+ public abstract InputStream getBase64Content() throws SOAPException;
+
+ /**
+ * Sets the content of this attachment part to that of the given
+ * <code>Object</code> and sets the value of the <code>Content-Type</code>
+ * header to the given type. The type of the
+ * <code>Object</code> should correspond to the value given for the
+ * <code>Content-Type</code>. This depends on the particular
+ * set of <code>DataContentHandler</code> objects in use.
+ *
+ *
+ * @param object the Java object that makes up the content for
+ * this attachment part
+ * @param contentType the MIME string that specifies the type of
+ * the content
+ *
+ * @exception IllegalArgumentException may be thrown if the contentType
+ * does not match the type of the content object, or if there
+ * was no <code>DataContentHandler</code> object for this
+ * content object
+ *
+ * @see #getContent
+ */
+ public abstract void setContent(Object object, String contentType);
+
+ /**
+ * Sets the content of this attachment part to that contained by the
+ * <code>InputStream</code> <code>content</code> and sets the value of the
+ * <code>Content-Type</code> header to the value contained in
+ * <code>contentType</code>.
+ * <P>
+ * A subsequent call to getSize() may not be an exact measure
+ * of the content size.
+ *
+ * @param content the raw data to add to the attachment part
+ * @param contentType the value to set into the <code>Content-Type</code>
+ * header
+ *
+ * @exception SOAPException if an there is an error in setting the content
+ * @exception NullPointerException if <code>content</code> is null
+ * @since SAAJ 1.3
+ */
+ public abstract void setRawContent(InputStream content, String contentType) throws SOAPException;
+
+ /**
+ * Sets the content of this attachment part to that contained by the
+ * <code>byte[]</code> array <code>content</code> and sets the value of the
+ * <code>Content-Type</code> header to the value contained in
+ * <code>contentType</code>.
+ *
+ * @param content the raw data to add to the attachment part
+ * @param contentType the value to set into the <code>Content-Type</code>
+ * header
+ * @param offset the offset in the byte array of the content
+ * @param len the number of bytes that form the content
+ *
+ * @exception SOAPException if an there is an error in setting the content
+ * or content is null
+ * @since SAAJ 1.3
+ */
+ public abstract void setRawContentBytes(
+ byte[] content, int offset, int len, String contentType)
+ throws SOAPException;
+
+
+ /**
+ * Sets the content of this attachment part from the Base64 source
+ * <code>InputStream</code> and sets the value of the
+ * <code>Content-Type</code> header to the value contained in
+ * <code>contentType</code>, This method would first decode the base64
+ * input and write the resulting raw bytes to the attachment.
+ * <P>
+ * A subsequent call to getSize() may not be an exact measure
+ * of the content size.
+ *
+ * @param content the base64 encoded data to add to the attachment part
+ * @param contentType the value to set into the <code>Content-Type</code>
+ * header
+ *
+ * @exception SOAPException if an there is an error in setting the content
+ * @exception NullPointerException if <code>content</code> is null
+ *
+ * @since SAAJ 1.3
+ */
+ public abstract void setBase64Content(
+ InputStream content, String contentType) throws SOAPException;
+
+
+ /**
+ * Gets the <code>DataHandler</code> object for this <code>AttachmentPart</code>
+ * object.
+ *
+ * @return the <code>DataHandler</code> object associated with this
+ * <code>AttachmentPart</code> object
+ *
+ * @exception SOAPException if there is no data in
+ * this <code>AttachmentPart</code> object
+ */
+ public abstract DataHandler getDataHandler()
+ throws SOAPException;
+
+ /**
+ * Sets the given <code>DataHandler</code> object as the data handler
+ * for this <code>AttachmentPart</code> object. Typically, on an incoming
+ * message, the data handler is automatically set. When
+ * a message is being created and populated with content, the
+ * <code>setDataHandler</code> method can be used to get data from
+ * various data sources into the message.
+ *
+ * @param dataHandler the <code>DataHandler</code> object to be set
+ *
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified <code>DataHandler</code> object
+ */
+ public abstract void setDataHandler(DataHandler dataHandler);
+
+
+ /**
+ * Gets the value of the MIME header whose name is "Content-ID".
+ *
+ * @return a <code>String</code> giving the value of the
+ * "Content-ID" header or <code>null</code> if there
+ * is none
+ * @see #setContentId
+ */
+ public String getContentId() {
+ String[] values = getMimeHeader("Content-ID");
+ if (values != null && values.length > 0)
+ return values[0];
+ return null;
+ }
+
+ /**
+ * Gets the value of the MIME header whose name is "Content-Location".
+ *
+ * @return a <code>String</code> giving the value of the
+ * "Content-Location" header or <code>null</code> if there
+ * is none
+ */
+ public String getContentLocation() {
+ String[] values = getMimeHeader("Content-Location");
+ if (values != null && values.length > 0)
+ return values[0];
+ return null;
+ }
+
+ /**
+ * Gets the value of the MIME header whose name is "Content-Type".
+ *
+ * @return a <code>String</code> giving the value of the
+ * "Content-Type" header or <code>null</code> if there
+ * is none
+ */
+ public String getContentType() {
+ String[] values = getMimeHeader("Content-Type");
+ if (values != null && values.length > 0)
+ return values[0];
+ return null;
+ }
+
+ /**
+ * Sets the MIME header whose name is "Content-ID" with the given value.
+ *
+ * @param contentId a <code>String</code> giving the value of the
+ * "Content-ID" header
+ *
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified <code>contentId</code> value
+ * @see #getContentId
+ */
+ public void setContentId(String contentId)
+ {
+ setMimeHeader("Content-ID", contentId);
+ }
+
+
+ /**
+ * Sets the MIME header whose name is "Content-Location" with the given value.
+ *
+ *
+ * @param contentLocation a <code>String</code> giving the value of the
+ * "Content-Location" header
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified content location
+ */
+ public void setContentLocation(String contentLocation)
+ {
+ setMimeHeader("Content-Location", contentLocation);
+ }
+
+ /**
+ * Sets the MIME header whose name is "Content-Type" with the given value.
+ *
+ * @param contentType a <code>String</code> giving the value of the
+ * "Content-Type" header
+ *
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified content type
+ */
+ public void setContentType(String contentType)
+ {
+ setMimeHeader("Content-Type", contentType);
+ }
+
+ /**
+ * Removes all MIME headers that match the given name.
+ *
+ * @param header the string name of the MIME header/s to
+ * be removed
+ */
+ public abstract void removeMimeHeader(String header);
+
+ /**
+ * Removes all the MIME header entries.
+ */
+ public abstract void removeAllMimeHeaders();
+
+
+ /**
+ * Gets all the values of the header identified by the given
+ * <code>String</code>.
+ *
+ * @param name the name of the header; example: "Content-Type"
+ * @return a <code>String</code> array giving the value for the
+ * specified header
+ * @see #setMimeHeader
+ */
+ public abstract String[] getMimeHeader(String name);
+
+
+ /**
+ * Changes the first header entry that matches the given name
+ * to the given value, adding a new header if no existing header
+ * matches. This method also removes all matching headers but the first. <p>
+ *
+ * Note that RFC822 headers can only contain US-ASCII characters.
+ *
+ * @param name a <code>String</code> giving the name of the header
+ * for which to search
+ * @param value a <code>String</code> giving the value to be set for
+ * the header whose name matches the given name
+ *
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified mime header name or value
+ */
+ public abstract void setMimeHeader(String name, String value);
+
+
+ /**
+ * Adds a MIME header with the specified name and value to this
+ * <code>AttachmentPart</code> object.
+ * <p>
+ * Note that RFC822 headers can contain only US-ASCII characters.
+ *
+ * @param name a <code>String</code> giving the name of the header
+ * to be added
+ * @param value a <code>String</code> giving the value of the header
+ * to be added
+ *
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified mime header name or value
+ */
+ public abstract void addMimeHeader(String name, String value);
+
+ /**
+ * Retrieves all the headers for this <code>AttachmentPart</code> object
+ * as an iterator over the <code>MimeHeader</code> objects.
+ *
+ * @return an <code>Iterator</code> object with all of the Mime
+ * headers for this <code>AttachmentPart</code> object
+ */
+ public abstract Iterator getAllMimeHeaders();
+
+ /**
+ * Retrieves all <code>MimeHeader</code> objects that match a name in
+ * the given array.
+ *
+ * @param names a <code>String</code> array with the name(s) of the
+ * MIME headers to be returned
+ * @return all of the MIME headers that match one of the names in the
+ * given array as an <code>Iterator</code> object
+ */
+ public abstract Iterator getMatchingMimeHeaders(String[] names);
+
+ /**
+ * Retrieves all <code>MimeHeader</code> objects whose name does
+ * not match a name in the given array.
+ *
+ * @param names a <code>String</code> array with the name(s) of the
+ * MIME headers not to be returned
+ * @return all of the MIME headers in this <code>AttachmentPart</code> object
+ * except those that match one of the names in the
+ * given array. The nonmatching MIME headers are returned as an
+ * <code>Iterator</code> object.
+ */
+ public abstract Iterator getNonMatchingMimeHeaders(String[] names);
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Detail.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Detail.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Detail.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,101 @@
+/*
+ * $Id: Detail.java,v 1.9 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.9 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A container for <code>DetailEntry</code> objects. <code>DetailEntry</code>
+ * objects give detailed error information that is application-specific and
+ * related to the <code>SOAPBody</code> object that contains it.
+ *<P>
+ * A <code>Detail</code> object, which is part of a <code>SOAPFault</code>
+ * object, can be retrieved using the method <code>SOAPFault.getDetail</code>.
+ * The <code>Detail</code> interface provides two methods. One creates a new
+ * <code>DetailEntry</code> object and also automatically adds it to
+ * the <code>Detail</code> object. The second method gets a list of the
+ * <code>DetailEntry</code> objects contained in a <code>Detail</code>
+ * object.
+ * <P>
+ * The following code fragment, in which <i>sf</i> is a <code>SOAPFault</code>
+ * object, gets its <code>Detail</code> object (<i>d</i>), adds a new
+ * <code>DetailEntry</code> object to <i>d</i>, and then gets a list of all the
+ * <code>DetailEntry</code> objects in <i>d</i>. The code also creates a
+ * <code>Name</code> object to pass to the method <code>addDetailEntry</code>.
+ * The variable <i>se</i>, used to create the <code>Name</code> object,
+ * is a <code>SOAPEnvelope</code> object.
+ * <PRE>
+ * Detail d = sf.getDetail();
+ * Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ * "http://www.wombat.org/trader");
+ * d.addDetailEntry(name);
+ * Iterator it = d.getDetailEntries();
+ * </PRE>
+ */
+public interface Detail extends SOAPFaultElement {
+
+ /**
+ * Creates a new <code>DetailEntry</code> object with the given
+ * name and adds it to this <code>Detail</code> object.
+ *
+ * @param name a <code>Name</code> object identifying the
+ * new <code>DetailEntry</code> object
+ *
+ * @exception SOAPException thrown when there is a problem in adding a
+ * DetailEntry object to this Detail object.
+ *
+ * @see Detail#addDetailEntry(QName qname)
+ */
+ public DetailEntry addDetailEntry(Name name) throws SOAPException;
+
+ /**
+ * Creates a new <code>DetailEntry</code> object with the given
+ * QName and adds it to this <code>Detail</code> object. This method
+ * is the preferred over the one using Name.
+ *
+ * @param qname a <code>QName</code> object identifying the
+ * new <code>DetailEntry</code> object
+ *
+ * @exception SOAPException thrown when there is a problem in adding a
+ * DetailEntry object to this Detail object.
+ *
+ * @see Detail#addDetailEntry(Name name)
+ * @since SAAJ 1.3
+ */
+ public DetailEntry addDetailEntry(QName qname) throws SOAPException;
+
+ /**
+ * Gets an Iterator over all of the <code>DetailEntry</code>s in this <code>Detail</code> object.
+ *
+ * @return an <code>Iterator</code> object over the <code>DetailEntry</code>
+ * objects in this <code>Detail</code> object
+ */
+ public Iterator getDetailEntries();
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/DetailEntry.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/DetailEntry.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/DetailEntry.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,38 @@
+/*
+ * $Id: DetailEntry.java,v 1.4 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.4 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * The content for a <code>Detail</code> object, giving details for
+ * a <code>SOAPFault</code> object. A <code>DetailEntry</code> object,
+ * which carries information about errors related to the <code>SOAPBody</code>
+ * object that contains it, is application-specific.
+ */
+public interface DetailEntry extends SOAPElement {
+
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/FactoryFinder.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/FactoryFinder.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/FactoryFinder.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,184 @@
+/*
+ * $Id: FactoryFinder.java,v 1.7 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.7 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package javax.xml.soap;
+
+import java.io.*;
+import java.util.Properties;
+
+
+class FactoryFinder {
+
+ /**
+ * Creates an instance of the specified class using the specified
+ * <code>ClassLoader</code> object.
+ *
+ * @exception SOAPException if the given class could not be found
+ * or could not be instantiated
+ */
+ private static Object newInstance(String className,
+ ClassLoader classLoader)
+ throws SOAPException
+ {
+ try {
+ Class spiClass;
+ if (classLoader == null) {
+ spiClass = Class.forName(className);
+ } else {
+ spiClass = classLoader.loadClass(className);
+ }
+ return spiClass.newInstance();
+ } catch (ClassNotFoundException x) {
+ throw new SOAPException(
+ "Provider " + className + " not found", x);
+ } catch (Exception x) {
+ throw new SOAPException(
+ "Provider " + className + " could not be instantiated: " + x,
+ x);
+ }
+ }
+
+ /**
+ * Finds the implementation <code>Class</code> object for the given
+ * factory name, or null if that fails.
+ * <P>
+ * This method is package private so that this code can be shared.
+ *
+ * @return the <code>Class</code> object of the specified message factory;
+ * or <code>null</code>
+ *
+ * @param factoryId the name of the factory to find, which is
+ * a system property
+ * @exception SOAPException if there is a SOAP error
+ */
+ static Object find(String factoryId)
+ throws SOAPException
+ {
+ ClassLoader classLoader;
+ try {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ } catch (Exception x) {
+ throw new SOAPException(x.toString(), x);
+ }
+
+ // Use the system property first
+ try {
+ String systemProp =
+ System.getProperty( factoryId );
+ if( systemProp!=null) {
+ return newInstance(systemProp, classLoader);
+ }
+ } catch (SecurityException se) {
+ }
+
+ // try to read from $java.home/lib/jaxm.properties
+ try {
+ String javah=System.getProperty( "java.home" );
+ String configFile = javah + File.separator +
+ "lib" + File.separator + "jaxm.properties";
+ File f=new File( configFile );
+ if( f.exists()) {
+ Properties props=new Properties();
+ props.load( new FileInputStream(f));
+ String factoryClassName = props.getProperty(factoryId);
+ return newInstance(factoryClassName, classLoader);
+ }
+ } catch(Exception ex ) {
+ }
+
+ String serviceId = "META-INF/services/" + factoryId;
+ // try to find services in CLASSPATH
+ try {
+ InputStream is=null;
+ if (classLoader == null) {
+ is=ClassLoader.getSystemResourceAsStream(serviceId);
+ } else {
+ is=classLoader.getResourceAsStream(serviceId);
+ }
+
+ if( is!=null ) {
+ BufferedReader rd =
+ new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+ String factoryClassName = rd.readLine();
+ rd.close();
+
+ if (factoryClassName != null &&
+ ! "".equals(factoryClassName)) {
+ return newInstance(factoryClassName, classLoader);
+ }
+ }
+ } catch( Exception ex ) {
+ }
+
+ return null;
+ }
+
+ /**
+ * Finds the implementation <code>Class</code> object for the given
+ * factory name, or if that fails, finds the <code>Class</code> object
+ * for the given fallback class name. The arguments supplied must be
+ * used in order. If using the first argument is successful, the second
+ * one will not be used.
+ * <P>
+ * This method is package private so that this code can be shared.
+ *
+ * @return the <code>Class</code> object of the specified message factory;
+ * may not be <code>null</code>
+ *
+ * @param factoryId the name of the factory to find, which is
+ * a system property
+ * @param fallbackClassName the implementation class name, which is
+ * to be used only if nothing else
+ * is found; <code>null</code> to indicate that
+ * there is no fallback class name
+ * @exception SOAPException if there is a SOAP error
+ */
+ static Object find(String factoryId, String fallbackClassName)
+ throws SOAPException
+ {
+
+ Object obj = find(factoryId);
+ if (obj != null)
+ return obj;
+
+ ClassLoader classLoader;
+ try {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ } catch (Exception x) {
+ throw new SOAPException(x.toString(), x);
+ }
+
+ if (fallbackClassName == null) {
+ throw new SOAPException(
+ "Provider for " + factoryId + " cannot be found", null);
+ }
+
+ return newInstance(fallbackClassName, classLoader);
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MessageFactory.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MessageFactory.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MessageFactory.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,198 @@
+/*
+ * $Id: MessageFactory.java,v 1.11 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.11 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A factory for creating <code>SOAPMessage</code> objects.
+ * <P>
+ * A SAAJ client can create a <code>MessageFactory</code> object
+ * using the method <code>newInstance</code>, as shown in the following
+ * lines of code.
+ * <PRE>
+ * MessageFactory mf = MessageFactory.newInstance();
+ * MessageFactory mf12 = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+ * </PRE>
+ * <P>
+ * All <code>MessageFactory</code> objects, regardless of how they are
+ * created, will produce <code>SOAPMessage</code> objects that
+ * have the following elements by default:
+ * <UL>
+ * <LI>A <code>SOAPPart</code> object
+ * <LI>A <code>SOAPEnvelope</code> object
+ * <LI>A <code>SOAPBody</code> object
+ * <LI>A <code>SOAPHeader</code> object
+ * </UL>
+ * In some cases, specialized MessageFactory objects may be obtained that produce messages
+ * prepopulated with additional entries in the <code>SOAPHeader</code> object and the
+ * <code>SOAPBody</code> object.
+ * The content of a new <code>SOAPMessage</code> object depends on which of the two
+ * <code>MessageFactory</code> methods is used to create it.
+ * <UL>
+ * <LI><code>createMessage()</code> <BR>
+ * This is the method clients would normally use to create a request message.
+ * <LI><code>createMessage(MimeHeaders, java.io.InputStream)</code> -- message has
+ * content from the <code>InputStream</code> object and headers from the
+ * <code>MimeHeaders</code> object <BR>
+ * This method can be used internally by a service implementation to
+ * create a message that is a response to a request.
+ * </UL>
+ */
+public abstract class MessageFactory {
+
+ static private final String DEFAULT_MESSAGE_FACTORY
+ = "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl";
+
+ static private final String MESSAGE_FACTORY_PROPERTY
+ = "javax.xml.soap.MessageFactory";
+
+ /**
+ * Creates a new <code>MessageFactory</code> object that is an instance
+ * of the default implementation (SOAP 1.1),
+ *
+ * This method uses the following ordered lookup procedure to determine the MessageFactory implementation class to load:
+ * <UL>
+ * <LI> Use the javax.xml.soap.MessageFactory system property.
+ * <LI> Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard
+ * java.util.Properties format and contains the fully qualified name of the implementation class with the key being the
+ * system property defined above.
+ * <LI> Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API
+ * will look for a classname in the file META-INF/services/javax.xml.soap.MessageFactory in jars available to the runtime.
+ * <LI> Use the SAAJMetaFactory instance to locate the MessageFactory implementation class.
+ * </UL>
+
+ *
+ * @return a new instance of a <code>MessageFactory</code>
+ *
+ * @exception SOAPException if there was an error in creating the
+ * default implementation of the
+ * <code>MessageFactory</code>.
+ * @see SAAJMetaFactory
+ */
+
+ public static MessageFactory newInstance()
+ throws SOAPException {
+ try {
+ MessageFactory factory = (MessageFactory)
+ FactoryFinder.find(MESSAGE_FACTORY_PROPERTY);
+
+ if (factory != null)
+ return factory;
+
+ return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+ } catch (Exception ex) {
+ throw new SOAPException(
+ "Unable to create message factory for SOAP: "
+ +ex.getMessage());
+ }
+
+ }
+
+ /**
+ * Creates a new <code>MessageFactory</code> object that is an instance
+ * of the specified implementation. May be a dynamic message factory,
+ * a SOAP 1.1 message factory, or a SOAP 1.2 message factory. A dynamic
+ * message factory creates messages based on the MIME headers specified
+ * as arguments to the <code>createMessage</code> method.
+ *
+ * This method uses the SAAJMetaFactory to locate the implementation class
+ * and create the MessageFactory instance.
+ *
+ * @return a new instance of a <code>MessageFactory</code>
+ *
+ * @param protocol a string constant representing the class of the
+ * specified message factory implementation. May be
+ * either <code>DYNAMIC_SOAP_PROTOCOL</code>,
+ * <code>DEFAULT_SOAP_PROTOCOL</code> (which is the same
+ * as) <code>SOAP_1_1_PROTOCOL</code>, or
+ * <code>SOAP_1_2_PROTOCOL</code>.
+ *
+ * @exception SOAPException if there was an error in creating the
+ * specified implementation of <code>MessageFactory</code>.
+ * @see SAAJMetaFactory
+ * @since SAAJ 1.3
+ */
+ public static MessageFactory newInstance(String protocol) throws SOAPException {
+ return SAAJMetaFactory.getInstance().newMessageFactory(protocol);
+ }
+
+ /**
+ * Creates a new <code>SOAPMessage</code> object with the default
+ * <code>SOAPPart</code>, <code>SOAPEnvelope</code>, <code>SOAPBody</code>,
+ * and <code>SOAPHeader</code> objects. Profile-specific message factories
+ * can choose to prepopulate the <code>SOAPMessage</code> object with
+ * profile-specific headers.
+ * <P>
+ * Content can be added to this message's <code>SOAPPart</code> object, and
+ * the message can be sent "as is" when a message containing only a SOAP part
+ * is sufficient. Otherwise, the <code>SOAPMessage</code> object needs
+ * to create one or more <code>AttachmentPart</code> objects and
+ * add them to itself. Any content that is not in XML format must be
+ * in an <code>AttachmentPart</code> object.
+ *
+ * @return a new <code>SOAPMessage</code> object
+ * @exception SOAPException if a SOAP error occurs
+ * @exception UnsupportedOperationException if the protocol of this
+ * <code>MessageFactory</code> instance is <code>DYNAMIC_SOAP_PROTOCOL</code>
+ */
+ public abstract SOAPMessage createMessage()
+ throws SOAPException;
+
+ /**
+ * Internalizes the contents of the given <code>InputStream</code> object into a
+ * new <code>SOAPMessage</code> object and returns the <code>SOAPMessage</code>
+ * object.
+ *
+ * @param in the <code>InputStream</code> object that contains the data
+ * for a message
+ * @param headers the transport-specific headers passed to the
+ * message in a transport-independent fashion for creation of the
+ * message
+ * @return a new <code>SOAPMessage</code> object containing the data from
+ * the given <code>InputStream</code> object
+ *
+ * @exception IOException if there is a problem in reading data from
+ * the input stream
+ *
+ * @exception SOAPException may be thrown if the message is invalid
+ *
+ * @exception IllegalArgumentException if the <code>MessageFactory</code>
+ * requires one or more MIME headers to be present in the
+ * <code>headers</code> parameter and they are missing.
+ * <code>MessageFactory</code> implementations for
+ * <code>SOAP_1_1_PROTOCOL</code> or
+ * <code>SOAP_1_2_PROTOCOL</code> must not throw
+ * <code>IllegalArgumentException</code> for this reason.
+ */
+ public abstract SOAPMessage createMessage(MimeHeaders headers,
+ InputStream in)
+ throws IOException, SOAPException;
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeader.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeader.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeader.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,72 @@
+/*
+ * $Id: MimeHeader.java,v 1.4 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.4 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+
+/**
+ * An object that stores a MIME header name and its value. One or more
+ * <code>MimeHeader</code> objects may be contained in a <code>MimeHeaders</code>
+ * object.
+ *
+ * @see MimeHeaders
+ */
+public class MimeHeader {
+
+ private String name;
+ private String value;
+
+ /**
+ * Constructs a <code>MimeHeader</code> object initialized with the given
+ * name and value.
+ *
+ * @param name a <code>String</code> giving the name of the header
+ * @param value a <code>String</code> giving the value of the header
+ */
+ public MimeHeader(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns the name of this <code>MimeHeader</code> object.
+ *
+ * @return the name of the header as a <code>String</code>
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the value of this <code>MimeHeader</code> object.
+ *
+ * @return the value of the header as a <code>String</code>
+ */
+ public String getValue() {
+ return value;
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeaders.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeaders.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/MimeHeaders.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,271 @@
+/*
+ * $Id: MimeHeaders.java,v 1.6 2006/03/30 00:59:38 ofung Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/03/30 00:59:38 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * A container for <code>MimeHeader</code> objects, which represent
+ * the MIME headers present in a MIME part of a message.
+ *
+ * <p>This class is used primarily when an application wants to
+ * retrieve specific attachments based on certain MIME headers and
+ * values. This class will most likely be used by implementations of
+ * <code>AttachmentPart</code> and other MIME dependent parts of the SAAJ
+ * API.
+ * @see SOAPMessage#getAttachments
+ * @see AttachmentPart
+ */
+public class MimeHeaders {
+ private Vector headers;
+
+ /**
+ * Constructs a default <code>MimeHeaders</code> object initialized with
+ * an empty <code>Vector</code> object.
+ */
+ public MimeHeaders() {
+ headers = new Vector();
+ }
+
+ /**
+ * Returns all of the values for the specified header as an array of
+ * <code>String</code> objects.
+ *
+ * @param name the name of the header for which values will be returned
+ * @return a <code>String</code> array with all of the values for the
+ * specified header
+ * @see #setHeader
+ */
+ public String[] getHeader(String name) {
+ Vector values = new Vector();
+
+ for(int i = 0; i < headers.size(); i++) {
+ MimeHeader hdr = (MimeHeader) headers.elementAt(i);
+ if (hdr.getName().equalsIgnoreCase(name)
+ && hdr.getValue() != null)
+ values.addElement(hdr.getValue());
+ }
+
+ if (values.size() == 0)
+ return null;
+
+ String r[] = new String[values.size()];
+ values.copyInto(r);
+ return r;
+ }
+
+ /**
+ * Replaces the current value of the first header entry whose name matches
+ * the given name with the given value, adding a new header if no existing header
+ * name matches. This method also removes all matching headers after the first one.
+ * <P>
+ * Note that RFC822 headers can contain only US-ASCII characters.
+ *
+ * @param name a <code>String</code> with the name of the header for
+ * which to search
+ * @param value a <code>String</code> with the value that will replace the
+ * current value of the specified header
+ *
+ * @exception IllegalArgumentException if there was a problem in the
+ * mime header name or the value being set
+ * @see #getHeader
+ */
+ public void setHeader(String name, String value)
+ {
+ boolean found = false;
+
+ if ((name == null) || name.equals(""))
+ throw new IllegalArgumentException("Illegal MimeHeader name");
+
+ for(int i = 0; i < headers.size(); i++) {
+ MimeHeader hdr = (MimeHeader) headers.elementAt(i);
+ if (hdr.getName().equalsIgnoreCase(name)) {
+ if (!found) {
+ headers.setElementAt(new MimeHeader(hdr.getName(),
+ value), i);
+ found = true;
+ }
+ else
+ headers.removeElementAt(i--);
+ }
+ }
+
+ if (!found)
+ addHeader(name, value);
+ }
+
+ /**
+ * Adds a <code>MimeHeader</code> object with the specified name and value
+ * to this <code>MimeHeaders</code> object's list of headers.
+ * <P>
+ * Note that RFC822 headers can contain only US-ASCII characters.
+ *
+ * @param name a <code>String</code> with the name of the header to
+ * be added
+ * @param value a <code>String</code> with the value of the header to
+ * be added
+ *
+ * @exception IllegalArgumentException if there was a problem in the
+ * mime header name or value being added
+ */
+ public void addHeader(String name, String value)
+ {
+ if ((name == null) || name.equals(""))
+ throw new IllegalArgumentException("Illegal MimeHeader name");
+
+ int pos = headers.size();
+
+ for(int i = pos - 1 ; i >= 0; i--) {
+ MimeHeader hdr = (MimeHeader) headers.elementAt(i);
+ if (hdr.getName().equalsIgnoreCase(name)) {
+ headers.insertElementAt(new MimeHeader(name, value),
+ i+1);
+ return;
+ }
+ }
+ headers.addElement(new MimeHeader(name, value));
+ }
+
+ /**
+ * Remove all <code>MimeHeader</code> objects whose name matches the
+ * given name.
+ *
+ * @param name a <code>String</code> with the name of the header for
+ * which to search
+ */
+ public void removeHeader(String name) {
+ for(int i = 0; i < headers.size(); i++) {
+ MimeHeader hdr = (MimeHeader) headers.elementAt(i);
+ if (hdr.getName().equalsIgnoreCase(name))
+ headers.removeElementAt(i--);
+ }
+ }
+
+ /**
+ * Removes all the header entries from this <code>MimeHeaders</code> object.
+ */
+ public void removeAllHeaders() {
+ headers.removeAllElements();
+ }
+
+
+ /**
+ * Returns all the <code>MimeHeader</code>s in this <code>MimeHeaders</code> object.
+ *
+ * @return an <code>Iterator</code> object over this <code>MimeHeaders</code>
+ * object's list of <code>MimeHeader</code> objects
+ */
+ public Iterator getAllHeaders() {
+ return headers.iterator();
+ }
+
+ class MatchingIterator implements Iterator {
+ private boolean match;
+ private Iterator iterator;
+ private String[] names;
+ private Object nextHeader;
+
+ MatchingIterator(String[] names, boolean match) {
+ this.match = match;
+ this.names = names;
+ this.iterator = headers.iterator();
+ }
+
+ private Object nextMatch() {
+ next:
+ while (iterator.hasNext()) {
+ MimeHeader hdr = (MimeHeader) iterator.next();
+
+ if (names == null)
+ return match ? null : hdr;
+
+ for(int i = 0; i < names.length; i++)
+ if (hdr.getName().equalsIgnoreCase(names[i]))
+ if (match)
+ return hdr;
+ else
+ continue next;
+ if (!match)
+ return hdr;
+ }
+ return null;
+ }
+
+
+ public boolean hasNext() {
+ if (nextHeader == null)
+ nextHeader = nextMatch();
+ return nextHeader != null;
+ }
+
+ public Object next() {
+ // hasNext should've prefetched the header for us,
+ // return it.
+ if (nextHeader != null) {
+ Object ret = nextHeader;
+ nextHeader = null;
+ return ret;
+ }
+ if (hasNext())
+ return nextHeader;
+ return null;
+ }
+
+ public void remove() {
+ iterator.remove();
+ }
+ }
+
+
+ /**
+ * Returns all the <code>MimeHeader</code> objects whose name matches
+ * a name in the given array of names.
+ *
+ * @param names an array of <code>String</code> objects with the names
+ * for which to search
+ * @return an <code>Iterator</code> object over the <code>MimeHeader</code>
+ * objects whose name matches one of the names in the given list
+ */
+ public Iterator getMatchingHeaders(String[] names) {
+ return new MatchingIterator(names, true);
+ }
+
+ /**
+ * Returns all of the <code>MimeHeader</code> objects whose name does not
+ * match a name in the given array of names.
+ *
+ * @param names an array of <code>String</code> objects with the names
+ * for which to search
+ * @return an <code>Iterator</code> object over the <code>MimeHeader</code>
+ * objects whose name does not match one of the names in the given list
+ */
+ public Iterator getNonMatchingHeaders(String[] names) {
+ return new MatchingIterator(names, false);
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Name.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Name.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Name.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,112 @@
+/*
+ * $Id: Name.java,v 1.5 2006/03/30 00:59:39 ofung Exp $
+ * $Revision: 1.5 $
+ * $Date: 2006/03/30 00:59:39 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of an XML name. This interface provides methods for
+ * getting the local and namespace-qualified names and also for getting the
+ * prefix associated with the namespace for the name. It is also possible
+ * to get the URI of the namespace.
+ * <P>
+ * The following is an example of a namespace declaration in an element.
+ * <PRE>
+ * <wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">
+ * </PRE>
+ * ("xmlns" stands for "XML namespace".)
+ * The following
+ * shows what the methods in the <code>Name</code> interface will return.
+ * <UL>
+ * <LI><code>getQualifiedName</code> will return "prefix:LocalName" =
+ * "WOMBAT:GetLastTradePrice"
+ * <LI><code>getURI</code> will return "http://www.wombat.org/trader"
+ * <LI><code>getLocalName</code> will return "GetLastTracePrice"
+ * <LI><code>getPrefix</code> will return "WOMBAT"
+ * </UL>
+ * <P>
+ * XML namespaces are used to disambiguate SOAP identifiers from
+ * application-specific identifiers.
+ * <P>
+ * <code>Name</code> objects are created using the method
+ * <code>SOAPEnvelope.createName</code>, which has two versions.
+ * One method creates <code>Name</code> objects with
+ * a local name, a namespace prefix, and a namespace URI.
+ * and the second creates <code>Name</code> objects with just a local name.
+ * The following line of
+ * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new
+ * <code>Name</code> object with all three.
+ * <PRE>
+ * Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ * "http://www.wombat.org/trader");
+ * </PRE>
+ * The following line of code gives an example of how a <code>Name</code> object
+ * can be used. The variable <i>element</i> is a <code>SOAPElement</code> object.
+ * This code creates a new <code>SOAPElement</code> object with the given name and
+ * adds it to <i>element</i>.
+ * <PRE>
+ * element.addChildElement(name);
+ * </PRE>
+ * <P>
+ * The <code>Name</code> interface may be deprecated in a future release of SAAJ
+ * in favor of <code>javax.xml.namespace.QName<code>
+ * @see SOAPEnvelope#createName(String, String, String) SOAPEnvelope.createName
+ * @see SOAPFactory#createName(String, String, String) SOAPFactory.createName
+ */
+public interface Name {
+ /**
+ * Gets the local name part of the XML name that this <code>Name</code>
+ * object represents.
+ *
+ * @return a string giving the local name
+ */
+ String getLocalName();
+
+ /**
+ * Gets the namespace-qualified name of the XML name that this
+ * <code>Name</code> object represents.
+ *
+ * @return the namespace-qualified name as a string
+ */
+ String getQualifiedName();
+
+ /**
+ * Returns the prefix that was specified when this <code>Name</code> object
+ * was initialized. This prefix is associated with the namespace for the XML
+ * name that this <code>Name</code> object represents.
+ *
+ * @return the prefix as a string
+ */
+ String getPrefix();
+
+ /**
+ * Returns the URI of the namespace for the XML
+ * name that this <code>Name</code> object represents.
+ *
+ * @return the URI as a string
+ */
+ String getURI();
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Node.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Node.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Node.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,114 @@
+/*
+ * $Id: Node.java,v 1.14 2006/03/30 00:59:39 ofung Exp $
+ * $Revision: 1.14 $
+ * $Date: 2006/03/30 00:59:39 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of a node (element) in an XML document.
+ * This interface extnends the standard DOM Node interface with methods for
+ * getting and setting the value of a node, for
+ * getting and setting the parent of a node, and for removing a node.
+ */
+public interface Node extends org.w3c.dom.Node {
+ /**
+ * Returns the value of this node if this is a <code>Text</code> node or the
+ * value of the immediate child of this node otherwise.
+ * If there is an immediate child of this <code>Node</code> that it is a
+ * <code>Text</code> node then it's value will be returned. If there is
+ * more than one <code>Text</code> node then the value of the first
+ * <code>Text</code> Node will be returned.
+ * Otherwise <code>null</code> is returned.
+ *
+ * @return a <code>String</code> with the text of this node if this is a
+ * <code>Text</code> node or the text contained by the first
+ * immediate child of this <code>Node</code> object that is a
+ * <code>Text</code> object if such a child exists;
+ * <code>null</code> otherwise.
+ */
+ public String getValue();
+
+ /**
+ * If this is a Text node then this method will set its value,
+ * otherwise it sets the value of the immediate (Text) child of this node.
+ * The value of the immediate child of this node can be set only if, there is
+ * one child node and that node is a <code>Text</code> node, or if
+ * there are no children in which case a child <code>Text</code> node will be
+ * created.
+ *
+ * @exception IllegalStateException if the node is not a <code>Text</code>
+ * node and either has more than one child node or has a child
+ * node that is not a <code>Text</code> node.
+ *
+ * @since SAAJ 1.2
+ */
+ public void setValue(String value);
+
+ /**
+ * Sets the parent of this <code>Node</code> object to the given
+ * <code>SOAPElement</code> object.
+ *
+ * @param parent the <code>SOAPElement</code> object to be set as
+ * the parent of this <code>Node</code> object
+ *
+ * @exception SOAPException if there is a problem in setting the
+ * parent to the given element
+ * @see #getParentElement
+ */
+ public void setParentElement(SOAPElement parent) throws SOAPException;
+
+ /**
+ * Returns the parent element of this <code>Node</code> object.
+ * This method can throw an <code>UnsupportedOperationException</code>
+ * if the tree is not kept in memory.
+ *
+ * @return the <code>SOAPElement</code> object that is the parent of
+ * this <code>Node</code> object or <code>null</code> if this
+ * <code>Node</code> object is root
+ *
+ * @exception UnsupportedOperationException if the whole tree is not
+ * kept in memory
+ * @see #setParentElement
+ */
+ public SOAPElement getParentElement();
+
+ /**
+ * Removes this <code>Node</code> object from the tree.
+ */
+ public void detachNode();
+
+ /**
+ * Notifies the implementation that this <code>Node</code>
+ * object is no longer being used by the application and that the
+ * implementation is free to reuse this object for nodes that may
+ * be created later.
+ * <P>
+ * Calling the method <code>recycleNode</code> implies that the method
+ * <code>detachNode</code> has been called previously.
+ */
+ public void recycleNode();
+
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJMetaFactory.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJMetaFactory.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJMetaFactory.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,120 @@
+/*
+ * $Id: SAAJMetaFactory.java,v 1.4 2006/03/30 00:59:39 ofung Exp $
+ * $Revision: 1.4 $
+ * $Date: 2006/03/30 00:59:39 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+* The access point for the implementation classes of the factories defined in the
+* SAAJ API. All of the <code>newInstance</code> methods defined on factories in
+* SAAJ 1.3 defer to instances of this class to do the actual object creation.
+* The implementations of <code>newInstance()</code> methods (in SOAPFactory and MessageFactory)
+* that existed in SAAJ 1.2 have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2
+* defined lookup fails to locate the Factory implementation class name.
+*
+* <p>
+* SAAJMetaFactory is a service provider interface. There are no public methods on this
+* class.
+*
+* @author SAAJ RI Development Team
+* @since SAAJ 1.3
+*/
+
+public abstract class SAAJMetaFactory {
+ static private final String META_FACTORY_CLASS_PROPERTY =
+ "javax.xml.soap.MetaFactory";
+ static private final String DEFAULT_META_FACTORY_CLASS =
+ "com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl";
+
+ static private SAAJMetaFactory instance = null;
+
+ /**
+ * Creates a new instance of a concrete <code>SAAJMetaFactory</code> object.
+ * The SAAJMetaFactory is an SPI, it pulls the creation of the other factories together into a
+ * single place. Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ
+ * implementation. Service providers provide the name of their <code>SAAJMetaFactory</code>
+ * implementation.
+ *
+ * This method uses the following ordered lookup procedure to determine the SAAJMetaFactory implementation class to load:
+ * <UL>
+ * <LI> Use the javax.xml.soap.MetaFactory system property.
+ * <LI> Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard
+ * java.util.Properties format and contains the fully qualified name of the implementation class with the key being the
+ * system property defined above.
+ * <LI> Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API
+ * will look for a classname in the file META-INF/services/javax.xml.soap.MetaFactory in jars available to the runtime.
+ * <LI> Default to com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl.
+ * </UL>
+ *
+ * @return a concrete <code>SAAJMetaFactory</code> object
+ * @exception SOAPException if there is an error in creating the <code>SAAJMetaFactory</code>
+ */
+ static synchronized SAAJMetaFactory getInstance() throws SOAPException {
+ if (instance == null) {
+ try {
+ instance =
+ (SAAJMetaFactory) FactoryFinder.find(
+ META_FACTORY_CLASS_PROPERTY,
+ DEFAULT_META_FACTORY_CLASS);
+ } catch (Exception e) {
+ throw new SOAPException(
+ "Unable to create SAAJ meta-factory" + e.getMessage());
+ }
+ }
+
+ return instance;
+ }
+
+ protected SAAJMetaFactory() { }
+
+ /**
+ * Creates a <code>MessageFactory</code> object for
+ * the given <code>String</code> protocol.
+ *
+ * @param protocol a <code>String</code> indicating the protocol
+ * @exception SOAPException if there is an error in creating the
+ * MessageFactory
+ * @see SOAPConstants#SOAP_1_1_PROTOCOL
+ * @see SOAPConstants#SOAP_1_2_PROTOCOL
+ * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL
+ */
+ protected abstract MessageFactory newMessageFactory(String protocol)
+ throws SOAPException;
+
+ /**
+ * Creates a <code>SOAPFactory</code> object for
+ * the given <code>String</code> protocol.
+ *
+ * @param protocol a <code>String</code> indicating the protocol
+ * @exception SOAPException if there is an error in creating the
+ * SOAPFactory
+ * @see SOAPConstants#SOAP_1_1_PROTOCOL
+ * @see SOAPConstants#SOAP_1_2_PROTOCOL
+ * @see SOAPConstants#DYNAMIC_SOAP_PROTOCOL
+ */
+ protected abstract SOAPFactory newSOAPFactory(String protocol)
+ throws SOAPException;
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJResult.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJResult.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SAAJResult.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,134 @@
+/*
+ * $Id: SAAJResult.java,v 1.5 2006/03/30 00:59:39 ofung Exp $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package javax.xml.soap;
+
+import javax.xml.transform.dom.DOMResult;
+
+/**
+ * Acts as a holder for the results of a JAXP transformation or a JAXB
+ * marshalling, in the form of a SAAJ tree. These results should be accessed
+ * by using the {@link #getResult()} method. The {@link DOMResult#getNode()}
+ * method should be avoided in almost all cases.
+ *
+ * @author XWS-Security Development Team
+ *
+ * @since SAAJ 1.3
+ */
+public class SAAJResult extends DOMResult {
+
+ /**
+ * Creates a <code>SAAJResult</code> that will present results in the form
+ * of a SAAJ tree that supports the default (SOAP 1.1) protocol.
+ * <p>
+ * This kind of <code>SAAJResult</code> is meant for use in situations where the
+ * results will be used as a parameter to a method that takes a parameter
+ * whose type, such as <code>SOAPElement</code>, is drawn from the SAAJ
+ * API. When used in a transformation, the results are populated into the
+ * <code>SOAPPart</code> of a <code>SOAPMessage</code> that is created internally.
+ * The <code>SOAPPart</code> returned by {@link DOMResult#getNode()}
+ * is not guaranteed to be well-formed.
+ *
+ * @throws SOAPException if there is a problem creating a <code>SOAPMessage</code>
+ *
+ * @since SAAJ 1.3
+ */
+ public SAAJResult() throws SOAPException {
+ this(MessageFactory.newInstance().createMessage());
+ }
+
+ /**
+ * Creates a <code>SAAJResult</code> that will present results in the form
+ * of a SAAJ tree that supports the specified protocol. The
+ * <code>DYNAMIC_SOAP_PROTOCOL</code> is ambiguous in this context and will
+ * cause this constructor to throw an <code>UnsupportedOperationException</code>.
+ * <p>
+ * This kind of <code>SAAJResult</code> is meant for use in situations where the
+ * results will be used as a parameter to a method that takes a parameter
+ * whose type, such as <code>SOAPElement</code>, is drawn from the SAAJ
+ * API. When used in a transformation the results are populated into the
+ * <code>SOAPPart</code> of a <code>SOAPMessage</code> that is created
+ * internally. The <code>SOAPPart</code> returned by {@link DOMResult#getNode()}
+ * is not guaranteed to be well-formed.
+ *
+ * @param protocol - the name of the SOAP protocol that the resulting SAAJ
+ * tree should support
+ *
+ * @throws SOAPException if a <code>SOAPMessage</code> supporting the
+ * specified protocol cannot be created
+ *
+ * @since SAAJ 1.3
+ */
+ public SAAJResult(String protocol) throws SOAPException {
+ this(MessageFactory.newInstance(protocol).createMessage());
+ }
+
+ /**
+ * Creates a <code>SAAJResult</code> that will write the results into the
+ * <code>SOAPPart</code> of the supplied <code>SOAPMessage</code>.
+ * In the normal case these results will be written using DOM APIs and,
+ * as a result, the finished <code>SOAPPart</code> will not be guaranteed
+ * to be well-formed unless the data used to create it is also well formed.
+ * When used in a transformation the validity of the <code>SOAPMessage</code>
+ * after the transformation can be guaranteed only by means outside SAAJ
+ * specification.
+ *
+ * @param message - the message whose <code>SOAPPart</code> will be
+ * populated as a result of some transformation or
+ * marshalling operation
+ *
+ * @since SAAJ 1.3
+ */
+ public SAAJResult(SOAPMessage message) {
+ super(message.getSOAPPart());
+ }
+
+ /**
+ * Creates a <code>SAAJResult</code> that will write the results as a
+ * child node of the <code>SOAPElement</code> specified. In the normal
+ * case these results will be written using DOM APIs and as a result may
+ * invalidate the structure of the SAAJ tree. This kind of
+ * <code>SAAJResult</code> should only be used when the validity of the
+ * incoming data can be guaranteed by means outside of the SAAJ
+ * specification.
+ *
+ * @param rootNode - the root to which the results will be appended
+ *
+ * @since SAAJ 1.3
+ */
+ public SAAJResult(SOAPElement rootNode) {
+ super(rootNode);
+ }
+
+
+ /**
+ * @return the resulting Tree that was created under the specified root Node.
+ * @since SAAJ 1.3
+ */
+ public javax.xml.soap.Node getResult() {
+ return (javax.xml.soap.Node)super.getNode().getFirstChild();
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBody.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBody.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBody.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,299 @@
+/*
+ * $Id: SOAPBody.java,v 1.18 2006/03/30 00:59:39 ofung Exp $
+ * $Revision: 1.18 $
+ * $Date: 2006/03/30 00:59:39 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Locale;
+
+import org.w3c.dom.Document;
+
+import javax.xml.namespace.QName;
+
+/**
+ * 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.
+ * <P>
+ * A <code>SOAPBody</code> object contains <code>SOAPBodyElement</code>
+ * objects, which have the content for the SOAP body.
+ * A <code>SOAPFault</code> object, which carries status and/or
+ * error information, is an example of a <code>SOAPBodyElement</code> object.
+ *
+ * @see SOAPFault
+ */
+public interface SOAPBody extends SOAPElement {
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to
+ * this <code>SOAPBody</code> object. The new <code>SOAPFault</code> will
+ * have default values set for the mandatory child elements. The type of
+ * the <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code>
+ * depending on the <code>protocol</code> specified while creating the
+ * <code>MessageFactory</code> instance.
+ * <p>
+ * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
+ * child element.
+ *
+ * @return the new <code>SOAPFault</code> object
+ * @exception SOAPException if there is a SOAP error
+ */
+ public SOAPFault addFault() throws SOAPException;
+
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to
+ * this <code>SOAPBody</code> object. The type of the
+ * <code>SOAPFault</code> will be a SOAP 1.1 or a SOAP 1.2
+ * <code>SOAPFault</code> depending on the <code>protocol</code>
+ * specified while creating the <code>MessageFactory</code> instance.
+ * <p>
+ * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
+ * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
+ * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
+ * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
+ * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
+ * element.
+ * <p>
+ * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
+ * child element.
+ *
+ * @param faultCode a <code>Name</code> 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 <code>String</code> giving an explanation of
+ * the fault
+ * @param locale a {@link java.util.Locale} object indicating
+ * the native language of the <code>faultString</code>
+ * @return the new <code>SOAPFault</code> object
+ * @exception SOAPException if there is a SOAP error
+ * @see SOAPFault#setFaultCode
+ * @see SOAPFault#setFaultString
+ * @since SAAJ 1.2
+ */
+ public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to this
+ * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
+ * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
+ * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
+ * instance.
+ * <p>
+ * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
+ * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
+ * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
+ * the <code>faultCode</code> parameter is the value of the <code>faultcode</code>
+ * element and the <code>faultString</code> parameter is the value of the <code>faultstring</code>
+ * element.
+ * <p>
+ * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
+ * child element.
+ *
+ * @param faultCode
+ * a <code>QName</code> 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 <code>String</code> giving an explanation of the fault
+ * @param locale
+ * a {@link java.util.Locale Locale} object indicating the
+ * native language of the <code>faultString</code>
+ * @return the new <code>SOAPFault</code> object
+ * @exception SOAPException
+ * if there is a SOAP error
+ * @see SOAPFault#setFaultCode
+ * @see SOAPFault#setFaultString
+ * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale)
+ *
+ * @since SAAJ 1.3
+ */
+ public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to this
+ * <code>SOAPBody</code> object. The type of the <code>SOAPFault</code>
+ * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
+ * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
+ * instance.
+ * <p>
+ * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
+ * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
+ * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
+ * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
+ * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
+ * element.
+ * <p>
+ * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
+ * attribute on the <i>Fault/Reason/Text</i> element will be set to
+ * <code>java.util.Locale.getDefault()</code>
+ * <p>
+ * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
+ * child element.
+ *
+ * @param faultCode
+ * a <code>Name</code> 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 <code>String</code> giving an explanation of the fault
+ * @return the new <code>SOAPFault</code> object
+ * @exception SOAPException
+ * if there is a SOAP error
+ * @see SOAPFault#setFaultCode
+ * @see SOAPFault#setFaultString
+ * @since SAAJ 1.2
+ */
+ public SOAPFault addFault(Name faultCode, String faultString)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPFault</code> object and adds it to this <code>SOAPBody</code>
+ * object. The type of the <code>SOAPFault</code>
+ * will be a SOAP 1.1 or a SOAP 1.2 <code>SOAPFault</code> depending on
+ * the <code>protocol</code> specified while creating the <code>MessageFactory</code>
+ * instance.
+ * <p>
+ * For SOAP 1.2 the <code>faultCode</code> parameter is the value of the
+ * <i>Fault/Code/Value</i> element and the <code>faultString</code> parameter
+ * is the value of the <i>Fault/Reason/Text</i> element. For SOAP 1.1
+ * the <code>faultCode</code> parameter is the value of the <i>faultcode</i>
+ * element and the <code>faultString</code> parameter is the value of the <i>faultstring</i>
+ * element.
+ * <p>
+ * In case of a SOAP 1.2 fault, the default value for the mandatory <code>xml:lang</code>
+ * attribute on the <i>Fault/Reason/Text</i> element will be set to
+ * <code>java.util.Locale.getDefault()</code>
+ * <p>
+ * A <code>SOAPBody</code> may contain at most one <code>SOAPFault</code>
+ * child element
+ *
+ * @param faultCode
+ * a <code>QName</code> 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 <code>String</code> giving an explanation of the fault
+ * @return the new <code>SOAPFault</code> object
+ * @exception SOAPException
+ * if there is a SOAP error
+ * @see SOAPFault#setFaultCode
+ * @see SOAPFault#setFaultString
+ * @see SOAPBody#addFault(Name faultCode, String faultString)
+ * @since SAAJ 1.3
+ */
+ public SOAPFault addFault(QName faultCode, String faultString)
+ throws SOAPException;
+
+ /**
+ * Indicates whether a <code>SOAPFault</code> object exists in this
+ * <code>SOAPBody</code> object.
+ *
+ * @return <code>true</code> if a <code>SOAPFault</code> object exists
+ * in this <code>SOAPBody</code> object; <code>false</code>
+ * otherwise
+ */
+ public boolean hasFault();
+
+ /**
+ * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object.
+ *
+ * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+ * object if present, null otherwise.
+ */
+ public SOAPFault getFault();
+
+ /**
+ * Creates a new <code>SOAPBodyElement</code> object with the specified
+ * name and adds it to this <code>SOAPBody</code> object.
+ *
+ * @param name
+ * a <code>Name</code> object with the name for the new <code>SOAPBodyElement</code>
+ * object
+ * @return the new <code>SOAPBodyElement</code> object
+ * @exception SOAPException
+ * if a SOAP error occurs
+ * @see SOAPBody#addBodyElement(javax.xml.namespace.QName)
+ */
+ public SOAPBodyElement addBodyElement(Name name) throws SOAPException;
+
+
+ /**
+ * Creates a new <code>SOAPBodyElement</code> object with the specified
+ * QName and adds it to this <code>SOAPBody</code> object.
+ *
+ * @param qname
+ * a <code>QName</code> object with the qname for the new
+ * <code>SOAPBodyElement</code> object
+ * @return the new <code>SOAPBodyElement</code> object
+ * @exception SOAPException
+ * if a SOAP error occurs
+ * @see SOAPBody#addBodyElement(Name)
+ * @since SAAJ 1.3
+ */
+ public SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
+
+ /**
+ * Adds the root node of the DOM <code>{@link org.w3c.dom.Document}</code>
+ * to this <code>SOAPBody</code> object.
+ * <p>
+ * Calling this method invalidates the <code>document</code> parameter.
+ * The client application should discard all references to this <code>Document</code>
+ * and its contents upon calling <code>addDocument</code>. The behavior
+ * of an application that continues to use such references is undefined.
+ *
+ * @param document
+ * the <code>Document</code> object whose root node will be
+ * added to this <code>SOAPBody</code>.
+ * @return the <code>SOAPBodyElement</code> that represents the root node
+ * that was added.
+ * @exception SOAPException
+ * if the <code>Document</code> cannot be added
+ * @since SAAJ 1.2
+ */
+ public SOAPBodyElement addDocument(org.w3c.dom.Document document)
+ throws SOAPException;
+
+ /**
+ * Creates a new DOM <code>{@link org.w3c.dom.Document}</code> and sets
+ * the first child of this <code>SOAPBody</code> as it's document
+ * element. The child <code>SOAPElement</code> is removed as part of the
+ * process.
+ *
+ * @return the <code>{@link org.w3c.dom.Document}</code> representation
+ * of the <code>SOAPBody</code> content.
+ *
+ * @exception SOAPException
+ * if there is not exactly one child <code>SOAPElement</code> of the <code>
+ * <code>SOAPBody</code>.
+ *
+ * @since SAAJ 1.3
+ */
+ public org.w3c.dom.Document extractContentAsDocument()
+ throws SOAPException;
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBodyElement.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBodyElement.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPBodyElement.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,45 @@
+/*
+ * $Id: SOAPBodyElement.java,v 1.4 2006/03/30 00:59:40 ofung Exp $
+ * $Revision: 1.4 $
+ * $Date: 2006/03/30 00:59:40 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * A <code>SOAPBodyElement</code> object represents the contents in
+ * a <code>SOAPBody</code> object. The <code>SOAPFault</code> interface
+ * is a <code>SOAPBodyElement</code> object that has been defined.
+ * <P>
+ * A new <code>SOAPBodyElement</code> object can be created and added
+ * to a <code>SOAPBody</code> object with the <code>SOAPBody</code>
+ * method <code>addBodyElement</code>. In the following line of code,
+ * <code>sb</code> is a <code>SOAPBody</code> object, and
+ * <code>myName</code> is a <code>Name</code> object.
+ * <PRE>
+ * SOAPBodyElement sbe = sb.addBodyElement(myName);
+ * </PRE>
+ */
+public interface SOAPBodyElement extends SOAPElement {
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnection.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnection.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnection.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,97 @@
+/*
+ * $Id: SOAPConnection.java,v 1.13 2006/03/30 00:59:40 ofung Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/03/30 00:59:40 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+
+/**
+ * A point-to-point connection that a client can use for sending messages
+ * directly to a remote party (represented by a URL, for instance).
+ * <p>
+ * The SOAPConnection class is optional. Some implementations may
+ * not implement this interface in which case the call to
+ * <code>SOAPConnectionFactory.newInstance()</code> (see below) will
+ * throw an <code>UnsupportedOperationException</code>.
+ * <p>
+ * A client can obtain a <code>SOAPConnection</code> object using a
+ * {@link SOAPConnectionFactory} object as in the following example:
+ * <PRE>
+ * SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
+ * SOAPConnection con = factory.createConnection();
+ * </PRE>
+ * A <code>SOAPConnection</code> object can be used to send messages
+ * directly to a URL following the request/response paradigm. That is,
+ * messages are sent using the method <code>call</code>, which sends the
+ * message and then waits until it gets a reply.
+ */
+public abstract class SOAPConnection {
+
+ /**
+ * Sends the given message to the specified endpoint and blocks until
+ * it has returned the response.
+ *
+ * @param request the <code>SOAPMessage</code> object to be sent
+ * @param to an <code>Object</code> that identifies
+ * where the message should be sent. It is required to
+ * support Objects of type
+ * <code>java.lang.String</code>,
+ * <code>java.net.URL</code>, and when JAXM is present
+ * <code>javax.xml.messaging.URLEndpoint</code>
+ *
+ * @return the <code>SOAPMessage</code> object that is the response to the
+ * message that was sent
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract SOAPMessage call(SOAPMessage request,
+ Object to) throws SOAPException;
+
+ /**
+ * Gets a message from a specific endpoint and blocks until it receives,
+ *
+ * @param to an <code>Object</code> that identifies where
+ * the request should be sent. Objects of type
+ * <code>java.lang.String</code> and
+ * <code>java.net.URL</code> must be supported.
+ *
+ * @return the <code>SOAPMessage</code> object that is the response to the
+ * get message request
+ * @throws SOAPException if there is a SOAP error
+ * @since SAAJ 1.3
+ */
+ public SOAPMessage get(Object to)
+ throws SOAPException {
+ throw new UnsupportedOperationException("All subclasses of SOAPConnection must override get()");
+ }
+
+ /**
+ * Closes this <code>SOAPConnection</code> object.
+ *
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract void close()
+ throws SOAPException;
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnectionFactory.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnectionFactory.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConnectionFactory.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,89 @@
+/*
+ * $Id: SOAPConnectionFactory.java,v 1.6 2006/03/30 00:59:40 ofung Exp $
+ * $Revision: 1.6 $
+ * $Date: 2006/03/30 00:59:40 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * A factory for creating <code>SOAPConnection</code> objects. Implementation of this class
+ * is optional. If <code>SOAPConnectionFactory.newInstance()</code> throws an
+ * UnsupportedOperationException then the implementation does not support the
+ * SAAJ communication infrastructure. Otherwise {@link SOAPConnection} objects
+ * can be created by calling <code>createConnection()</code> on the newly
+ * created <code>SOAPConnectionFactory</code> object.
+ */
+public abstract class SOAPConnectionFactory {
+ /**
+ * A constant representing the default value for a <code>SOAPConnection</code>
+ * object. The default is the point-to-point SOAP connection.
+ */
+ static private final String DEFAULT_SOAP_CONNECTION_FACTORY
+ = "com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory";
+
+ /**
+ * A constant representing the <code>SOAPConnection</code> class.
+ */
+ static private final String SF_PROPERTY
+ = "javax.xml.soap.SOAPConnectionFactory";
+
+ /**
+ * Creates an instance of the default
+ * <code>SOAPConnectionFactory</code> object.
+ *
+ * @return a new instance of a default
+ * <code>SOAPConnectionFactory</code> object
+ *
+ * @exception SOAPException if there was an error creating the
+ * <code>SOAPConnectionFactory</code>
+ *
+ * @exception UnsupportedOperationException if newInstance is not
+ * supported.
+ */
+ public static SOAPConnectionFactory newInstance()
+ throws SOAPException, UnsupportedOperationException
+ {
+ try {
+ return (SOAPConnectionFactory)
+ FactoryFinder.find(SF_PROPERTY,
+ DEFAULT_SOAP_CONNECTION_FACTORY);
+ } catch (Exception ex) {
+ throw new SOAPException("Unable to create SOAP connection factory: "
+ +ex.getMessage());
+ }
+ }
+
+ /**
+ * Create a new <code>SOAPConnection</code>.
+ *
+ * @return the new <code>SOAPConnection</code> object.
+ *
+ * @exception SOAPException if there was an exception creating the
+ * <code>SOAPConnection</code> object.
+ */
+ public abstract SOAPConnection createConnection()
+ throws SOAPException;
+}
+
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConstants.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConstants.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPConstants.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,203 @@
+/*
+ * $Id: SOAPConstants.java,v 1.13 2006/03/30 00:59:40 ofung Exp $
+ * $Revision: 1.13 $
+ * $Date: 2006/03/30 00:59:40 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The definition of constants pertaining to the SOAP protocol.
+ */
+public interface SOAPConstants {
+ /**
+ * Used to create <code>MessageFactory</code> instances that create
+ * <code>SOAPMessages</code> whose concrete type is based on the
+ * <code>Content-Type</code> MIME header passed to the
+ * <code>createMessage</code> method. If no <code>Content-Type</code>
+ * header is passed then the <code>createMessage</code> may throw an
+ * <code>IllegalArgumentException</code> or, in the case of the no
+ * argument version of <code>createMessage</code>, an
+ * <code>UnsupportedOperationException</code>.
+ *
+ * @since SAAJ 1.3
+ */
+ public static final String DYNAMIC_SOAP_PROTOCOL = "Dynamic Protocol";
+
+ /**
+ * Used to create <code>MessageFactory</code> instances that create
+ * <code>SOAPMessages</code> whose behavior supports the SOAP 1.1 specification.
+ *
+ * @since SAAJ 1.3
+ */
+ public static final String SOAP_1_1_PROTOCOL = "SOAP 1.1 Protocol";
+
+ /**
+ * Used to create <code>MessageFactory</code> instances that create
+ * <code>SOAPMessages</code> whose behavior supports the SOAP 1.2
+ * specification
+ *
+ * @since SAAJ 1.3
+ */
+ public static final String SOAP_1_2_PROTOCOL = "SOAP 1.2 Protocol";
+
+ /**
+ * The default protocol: SOAP 1.1 for backwards compatibility.
+ *
+ * @since SAAJ 1.3
+ */
+ public static final String DEFAULT_SOAP_PROTOCOL = SOAP_1_1_PROTOCOL;
+
+ /**
+ * The namespace identifier for the SOAP 1.1 envelope.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ URI_NS_SOAP_1_1_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/";
+ /**
+ * The namespace identifier for the SOAP 1.2 envelope.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ URI_NS_SOAP_1_2_ENVELOPE = "http://www.w3.org/2003/05/soap-envelope";
+
+ /**
+ * The namespace identifier for the SOAP 1.1 envelope, All SOAPElements in this
+ * namespace are defined by the SOAP 1.1 specification.
+ */
+ public static final String
+ URI_NS_SOAP_ENVELOPE = URI_NS_SOAP_1_1_ENVELOPE;
+
+ /**
+ * The namespace identifier for the SOAP 1.1 encoding.
+ * An attribute named <code>encodingStyle</code> in the
+ * <code>URI_NS_SOAP_ENVELOPE</code> namespace and set to the value
+ * <code>URI_NS_SOAP_ENCODING</code> can be added to an element to indicate
+ * that it is encoded using the rules in section 5 of the SOAP 1.1
+ * specification.
+ */
+ public static final String
+ URI_NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
+
+ /**
+ * The namespace identifier for the SOAP 1.2 encoding.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ URI_NS_SOAP_1_2_ENCODING = "http://www.w3.org/2003/05/soap-encoding";
+
+ /**
+ * The media type of the <code>Content-Type</code> MIME header in SOAP 1.1.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ SOAP_1_1_CONTENT_TYPE = "text/xml";
+
+ /**
+ * The media type of the <code>Content-Type</code> MIME header in SOAP 1.2.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ SOAP_1_2_CONTENT_TYPE = "application/soap+xml";
+
+ /**
+ * The URI identifying the next application processing a SOAP request as the intended
+ * actor for a SOAP 1.1 header entry (see section 4.2.2 of the SOAP 1.1 specification).
+ * <p>
+ * This value can be passed to
+ * {@link SOAPHeader#examineMustUnderstandHeaderElements(String)},
+ * {@link SOAPHeader#examineHeaderElements(String)} and
+ * {@link SOAPHeader#extractHeaderElements(String)}
+ */
+ public static final String
+ URI_SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
+
+ /**
+ * The URI identifying the next application processing a SOAP request as the intended
+ * role for a SOAP 1.2 header entry (see section 2.2 of part 1 of the SOAP 1.2
+ * specification).
+ * @since SAAJ 1.3
+ */
+ public static final String
+ URI_SOAP_1_2_ROLE_NEXT = URI_NS_SOAP_1_2_ENVELOPE + "/role/next";
+
+ /**
+ * The URI specifying the role None in SOAP 1.2.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ URI_SOAP_1_2_ROLE_NONE = URI_NS_SOAP_1_2_ENVELOPE + "/role/none";
+
+ /**
+ * The URI identifying the ultimate receiver of the SOAP 1.2 message.
+ * @since SAAJ 1.3
+ */
+ public static final String
+ URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER =
+ URI_NS_SOAP_1_2_ENVELOPE + "/role/ultimateReceiver";
+
+ /**
+ * The default namespace prefix for http://www.w3.org/2003/05/soap-envelope
+ * @since SAAJ 1.3
+ */
+ public static final String SOAP_ENV_PREFIX = "env";
+
+ /**
+ * SOAP 1.2 VersionMismatch Fault
+ * @since SAAJ 1.3
+ */
+ public static final QName SOAP_VERSIONMISMATCH_FAULT =
+ new QName(URI_NS_SOAP_1_2_ENVELOPE, "VersionMismatch", SOAP_ENV_PREFIX);
+
+ /**
+ * SOAP 1.2 MustUnderstand Fault
+ * @since SAAJ 1.3
+ */
+ public static final QName SOAP_MUSTUNDERSTAND_FAULT =
+ new QName(URI_NS_SOAP_1_2_ENVELOPE, "MustUnderstand", SOAP_ENV_PREFIX);
+
+ /**
+ * SOAP 1.2 DataEncodingUnknown Fault
+ * @since SAAJ 1.3
+ */
+ public static final QName SOAP_DATAENCODINGUNKNOWN_FAULT =
+ new QName(URI_NS_SOAP_1_2_ENVELOPE, "DataEncodingUnknown", SOAP_ENV_PREFIX);
+
+ /**
+ * SOAP 1.2 Sender Fault
+ * @since SAAJ 1.3
+ */
+ public static final QName SOAP_SENDER_FAULT =
+ new QName(URI_NS_SOAP_1_2_ENVELOPE, "Sender", SOAP_ENV_PREFIX);
+
+ /**
+ * SOAP 1.2 Receiver Fault
+ * @since SAAJ 1.3
+ */
+ public static final QName SOAP_RECEIVER_FAULT =
+ new QName(URI_NS_SOAP_1_2_ENVELOPE, "Receiver", SOAP_ENV_PREFIX);
+
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElement.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElement.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElement.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,526 @@
+/*
+ * $Id: SOAPElement.java,v 1.20 2006/03/30 00:59:40 ofung Exp $
+ * $Revision: 1.20 $
+ * $Date: 2006/03/30 00:59:40 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An object representing an element of a SOAP message that is allowed but not
+ * specifically prescribed by a SOAP specification. This interface serves as the
+ * base interface for those objects that are specifically prescribed by a SOAP
+ * specification.
+ * <p>
+ * Methods in this interface that are required to return SAAJ specific objects
+ * may "silently" replace nodes in the tree as required to successfully return
+ * objects of the correct type. See {@link #getChildElements()} and
+ * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
+ * for details.
+ */
+public interface SOAPElement extends Node, org.w3c.dom.Element {
+
+ /**
+ * Creates a new <code>SOAPElement</code> object initialized with the
+ * given <code>Name</code> object and adds the new element to this
+ * <code>SOAPElement</code> object.
+ * <P>
+ * This method may be deprecated in a future release of SAAJ in favor of
+ * addChildElement(javax.xml.namespace.QName)
+ *
+ * @param name a <code>Name</code> object with the XML name for the
+ * new element
+ *
+ * @return the new <code>SOAPElement</code> object that was created
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ * @see SOAPElement#addChildElement(javax.xml.namespace.QName)
+ */
+ public SOAPElement addChildElement(Name name) throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPElement</code> object initialized with the given
+ * <code>QName</code> object and adds the new element to this <code>SOAPElement</code>
+ * object. The <i>namespace</i>, <i>localname</i> and <i>prefix</i> of the new
+ * <code>SOAPElement</code> are all taken from the <code>qname</code> argument.
+ *
+ * @param qname a <code>QName</code> object with the XML name for the
+ * new element
+ *
+ * @return the new <code>SOAPElement</code> object that was created
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ * @see SOAPElement#addChildElement(Name)
+ * @since SAAJ 1.3
+ */
+ public SOAPElement addChildElement(QName qname) throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPElement</code> object initialized with the
+ * specified local name and adds the new element to this
+ * <code>SOAPElement</code> object.
+ * The new <code>SOAPElement</code> inherits any in-scope default namespace.
+ *
+ * @param localName a <code>String</code> giving the local name for
+ * the element
+ * @return the new <code>SOAPElement</code> object that was created
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ */
+ public SOAPElement addChildElement(String localName) throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPElement</code> object initialized with the
+ * specified local name and prefix and adds the new element to this
+ * <code>SOAPElement</code> object.
+ *
+ * @param localName a <code>String</code> giving the local name for
+ * the new element
+ * @param prefix a <code>String</code> giving the namespace prefix for
+ * the new element
+ *
+ * @return the new <code>SOAPElement</code> object that was created
+ * @exception SOAPException if the <code>prefix</code> is not valid in the
+ * context of this <code>SOAPElement</code> or if there is an error in creating the
+ * <code>SOAPElement</code> object
+ */
+ public SOAPElement addChildElement(String localName, String prefix)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPElement</code> object initialized with the
+ * specified local name, prefix, and URI and adds the new element to this
+ * <code>SOAPElement</code> object.
+ *
+ * @param localName a <code>String</code> giving the local name for
+ * the new element
+ * @param prefix a <code>String</code> giving the namespace prefix for
+ * the new element
+ * @param uri a <code>String</code> giving the URI of the namespace
+ * to which the new element belongs
+ *
+ * @return the new <code>SOAPElement</code> object that was created
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ */
+ public SOAPElement addChildElement(String localName, String prefix,
+ String uri)
+ throws SOAPException;
+
+ /**
+ * Add a <code>SOAPElement</code> as a child of this
+ * <code>SOAPElement</code> instance. The <code>SOAPElement</code>
+ * is expected to be created by a
+ * <code>SOAPFactory</code>. Callers should not rely on the
+ * element instance being added as is into the XML
+ * tree. Implementations could end up copying the content
+ * of the <code>SOAPElement</code> passed into an instance of
+ * a different <code>SOAPElement</code> implementation. For
+ * instance if <code>addChildElement()</code> is called on a
+ * <code>SOAPHeader</code>, <code>element</code> will be copied
+ * into an instance of a <code>SOAPHeaderElement</code>.
+ *
+ * <P>The fragment rooted in <code>element</code> is either added
+ * as a whole or not at all, if there was an error.
+ *
+ * <P>The fragment rooted in <code>element</code> cannot contain
+ * elements named "Envelope", "Header" or "Body" and in the SOAP
+ * namespace. Any namespace prefixes present in the fragment
+ * should be fully resolved using appropriate namespace
+ * declarations within the fragment itself.
+ *
+ * @param element the <code>SOAPElement</code> to be added as a
+ * new child
+ *
+ * @exception SOAPException if there was an error in adding this
+ * element as a child
+ *
+ * @return an instance representing the new SOAP element that was
+ * actually added to the tree.
+ */
+ public SOAPElement addChildElement(SOAPElement element)
+ throws SOAPException;
+
+ /**
+ * Detaches all children of this <code>SOAPElement</code>.
+ * <p>
+ * This method is useful for rolling back the construction of partially
+ * completed <code>SOAPHeaders</code> and <code>SOAPBodys</code> in
+ * preparation for sending a fault when an error condition is detected. It
+ * is also useful for recycling portions of a document within a SOAP
+ * message.
+ *
+ * @since SAAJ 1.2
+ */
+ public abstract void removeContents();
+
+ /**
+ * Creates a new <code>Text</code> object initialized with the given
+ * <code>String</code> and adds it to this <code>SOAPElement</code> object.
+ *
+ * @param text a <code>String</code> object with the textual content to be added
+ *
+ * @return the <code>SOAPElement</code> object into which
+ * the new <code>Text</code> object was inserted
+ * @exception SOAPException if there is an error in creating the
+ * new <code>Text</code> object or if it is not legal to
+ * attach it as a child to this
+ * <code>SOAPElement</code>
+ */
+ public SOAPElement addTextNode(String text) throws SOAPException;
+
+ /**
+ * Adds an attribute with the specified name and value to this
+ * <code>SOAPElement</code> object.
+ *
+ * @param name a <code>Name</code> object with the name of the attribute
+ * @param value a <code>String</code> giving the value of the attribute
+ * @return the <code>SOAPElement</code> object into which the attribute was
+ * inserted
+ *
+ * @exception SOAPException if there is an error in creating the
+ * Attribute, or it is invalid to set
+ an attribute with <code>Name</code>
+ <code>name</code> on this SOAPElement.
+ * @see SOAPElement#addAttribute(javax.xml.namespace.QName, String)
+ */
+ public SOAPElement addAttribute(Name name, String value)
+ throws SOAPException;
+
+ /**
+ * Adds an attribute with the specified name and value to this
+ * <code>SOAPElement</code> object.
+ *
+ * @param qname a <code>QName</code> object with the name of the attribute
+ * @param value a <code>String</code> giving the value of the attribute
+ * @return the <code>SOAPElement</code> object into which the attribute was
+ * inserted
+ *
+ * @exception SOAPException if there is an error in creating the
+ * Attribute, or it is invalid to set
+ an attribute with <code>QName</code>
+ <code>qname</code> on this SOAPElement.
+ * @see SOAPElement#addAttribute(Name, String)
+ * @since SAAJ 1.3
+ */
+ public SOAPElement addAttribute(QName qname, String value)
+ throws SOAPException;
+
+ /**
+ * Adds a namespace declaration with the specified prefix and URI to this
+ * <code>SOAPElement</code> object.
+ *
+ * @param prefix a <code>String</code> giving the prefix of the namespace
+ * @param uri a <code>String</code> giving the uri of the namespace
+ * @return the <code>SOAPElement</code> object into which this
+ * namespace declaration was inserted.
+ *
+ * @exception SOAPException if there is an error in creating the
+ * namespace
+ */
+ public SOAPElement addNamespaceDeclaration(String prefix, String uri)
+ throws SOAPException;
+
+ /**
+ * Returns the value of the attribute with the specified name.
+ *
+ * @param name a <code>Name</code> object with the name of the attribute
+ * @return a <code>String</code> giving the value of the specified
+ * attribute, Null if there is no such attribute
+ * @see SOAPElement#getAttributeValue(javax.xml.namespace.QName)
+ */
+ public String getAttributeValue(Name name);
+
+ /**
+ * Returns the value of the attribute with the specified qname.
+ *
+ * @param qname a <code>QName</code> object with the qname of the attribute
+ * @return a <code>String</code> giving the value of the specified
+ * attribute, Null if there is no such attribute
+ * @see SOAPElement#getAttributeValue(Name)
+ * @since SAAJ 1.3
+ */
+ public String getAttributeValue(QName qname);
+
+ /**
+ * Returns an <code>Iterator</code> over all of the attribute
+ * <code>Name</code> objects in this
+ * <code>SOAPElement</code> object. The iterator can be used to get
+ * the attribute names, which can then be passed to the method
+ * <code>getAttributeValue</code> to retrieve the value of each
+ * attribute.
+ *
+ * @see SOAPElement#getAllAttributesAsQNames()
+ * @return an iterator over the names of the attributes
+ */
+ public Iterator getAllAttributes();
+
+ /**
+ * Returns an <code>Iterator</code> over all of the attributes
+ * in this <code>SOAPElement</code> as <code>QName</code> objects.
+ * The iterator can be used to get the attribute QName, which can then
+ * be passed to the method <code>getAttributeValue</code> to retrieve
+ * the value of each attribute.
+ *
+ * @return an iterator over the QNames of the attributes
+ * @see SOAPElement#getAllAttributes()
+ * @since SAAJ 1.3
+ */
+ public Iterator getAllAttributesAsQNames();
+
+
+ /**
+ * Returns the URI of the namespace that has the given prefix.
+ *
+ * @param prefix a <code>String</code> giving the prefix of the namespace
+ * for which to search
+ * @return a <code>String</code> with the uri of the namespace that has
+ * the given prefix
+ */
+ public String getNamespaceURI(String prefix);
+
+ /**
+ * Returns an <code>Iterator</code> over the namespace prefix
+ * <code>String</code>s declared by this element. The prefixes returned by
+ * this iterator can be passed to the method
+ * <code>getNamespaceURI</code> to retrieve the URI of each namespace.
+ *
+ * @return an iterator over the namespace prefixes in this
+ * <code>SOAPElement</code> object
+ */
+ public Iterator getNamespacePrefixes();
+
+ /**
+ * Returns an <code>Iterator</code> over the namespace prefix
+ * <code>String</code>s visible to this element. The prefixes returned by
+ * this iterator can be passed to the method
+ * <code>getNamespaceURI</code> to retrieve the URI of each namespace.
+ *
+ * @return an iterator over the namespace prefixes are within scope of this
+ * <code>SOAPElement</code> object
+ *
+ * @since SAAJ 1.2
+ */
+ public Iterator getVisibleNamespacePrefixes();
+
+ /**
+ * Creates a <code>QName</code> whose namespace URI is the one associated
+ * with the parameter, <code>prefix</code>, in the context of this
+ * <code>SOAPElement</code>. The remaining elements of the new
+ * <code>QName</code> are taken directly from the parameters,
+ * <code>localName</code> and <code>prefix</code>.
+ *
+ * @param localName
+ * a <code>String</code> containing the local part of the name.
+ * @param prefix
+ * a <code>String</code> containing the prefix for the name.
+ *
+ * @return a <code>QName</code> with the specified <code>localName</code>
+ * and <code>prefix</code>, and with a namespace that is associated
+ * with the <code>prefix</code> in the context of this
+ * <code>SOAPElement</code>. This namespace will be the same as
+ * the one that would be returned by
+ * <code>{@link #getNamespaceURI(String)}</code> if it were given
+ * <code>prefix</code> as it's parameter.
+ *
+ * @exception SOAPException if the <code>QName</code> cannot be created.
+ *
+ * @since SAAJ 1.3
+ */
+ public QName createQName(String localName, String prefix)
+ throws SOAPException;
+ /**
+ * Returns the name of this <code>SOAPElement</code> object.
+ *
+ * @return a <code>Name</code> object with the name of this
+ * <code>SOAPElement</code> object
+ */
+ public Name getElementName();
+
+ /**
+ * Returns the qname of this <code>SOAPElement</code> object.
+ *
+ * @return a <code>QName</code> object with the qname of this
+ * <code>SOAPElement</code> object
+ * @see SOAPElement#getElementName()
+ * @since SAAJ 1.3
+ */
+ public QName getElementQName();
+
+ /**
+ * Changes the name of this <code>Element</code> to <code>newName</code> if
+ * possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody
+ * etc. cannot have their names changed using this method. Any attempt to do
+ * so will result in a SOAPException being thrown.
+ *<P>
+ * Callers should not rely on the element instance being renamed as is.
+ * Implementations could end up copying the content of the
+ * <code>SOAPElement</code> to a renamed instance.
+ *
+ * @param newName the new name for the <code>Element</code>.
+ *
+ * @exception SOAPException if changing the name of this <code>Element</code>
+ * is not allowed.
+ * @return The renamed Node
+ *
+ * @since SAAJ 1.3
+ */
+ public SOAPElement setElementQName(QName newName) throws SOAPException;
+
+ /**
+ * Removes the attribute with the specified name.
+ *
+ * @param name the <code>Name</code> object with the name of the
+ * attribute to be removed
+ * @return <code>true</code> if the attribute was
+ * removed successfully; <code>false</code> if it was not
+ * @see SOAPElement#removeAttribute(javax.xml.namespace.QName)
+ */
+ public boolean removeAttribute(Name name);
+
+ /**
+ * Removes the attribute with the specified qname.
+ *
+ * @param qname the <code>QName</code> object with the qname of the
+ * attribute to be removed
+ * @return <code>true</code> if the attribute was
+ * removed successfully; <code>false</code> if it was not
+ * @see SOAPElement#removeAttribute(Name)
+ * @since SAAJ 1.3
+ */
+ public boolean removeAttribute(QName qname);
+
+ /**
+ * Removes the namespace declaration corresponding to the given prefix.
+ *
+ * @param prefix a <code>String</code> giving the prefix for which
+ * to search
+ * @return <code>true</code> if the namespace declaration was
+ * removed successfully; <code>false</code> if it was not
+ */
+ public boolean removeNamespaceDeclaration(String prefix);
+
+ /**
+ * Returns an <code>Iterator</code> over all the immediate child
+ * {@link Node}s of this element. This includes <code>javax.xml.soap.Text</code>
+ * objects as well as <code>SOAPElement</code> objects.
+ * <p>
+ * Calling this method may cause child <code>Element</code>,
+ * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be
+ * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>,
+ * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as
+ * appropriate for the type of this parent node. As a result the calling
+ * application must treat any existing references to these child nodes that
+ * have been obtained through DOM APIs as invalid and either discard them or
+ * refresh them with the values returned by this <code>Iterator</code>. This
+ * behavior can be avoided by calling the equivalent DOM APIs. See
+ * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
+ * for more details.
+ *
+ * @return an iterator with the content of this <code>SOAPElement</code>
+ * object
+ */
+ public Iterator getChildElements();
+
+ /**
+ * Returns an <code>Iterator</code> over all the immediate child
+ * {@link Node}s of this element with the specified name. All of these
+ * children will be <code>SOAPElement</code> nodes.
+ * <p>
+ * Calling this method may cause child <code>Element</code>,
+ * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be
+ * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>,
+ * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as
+ * appropriate for the type of this parent node. As a result the calling
+ * application must treat any existing references to these child nodes that
+ * have been obtained through DOM APIs as invalid and either discard them or
+ * refresh them with the values returned by this <code>Iterator</code>. This
+ * behavior can be avoided by calling the equivalent DOM APIs. See
+ * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
+ * for more details.
+ *
+ * @param name a <code>Name</code> object with the name of the child
+ * elements to be returned
+ *
+ * @return an <code>Iterator</code> object over all the elements
+ * in this <code>SOAPElement</code> object with the
+ * specified name
+ * @see SOAPElement#getChildElements(javax.xml.namespace.QName)
+ */
+ public Iterator getChildElements(Name name);
+
+ /**
+ * Returns an <code>Iterator</code> over all the immediate child
+ * {@link Node}s of this element with the specified qname. All of these
+ * children will be <code>SOAPElement</code> nodes.
+ * <p>
+ * Calling this method may cause child <code>Element</code>,
+ * <code>SOAPElement</code> and <code>org.w3c.dom.Text</code> nodes to be
+ * replaced by <code>SOAPElement</code>, <code>SOAPHeaderElement</code>,
+ * <code>SOAPBodyElement</code> or <code>javax.xml.soap.Text</code> nodes as
+ * appropriate for the type of this parent node. As a result the calling
+ * application must treat any existing references to these child nodes that
+ * have been obtained through DOM APIs as invalid and either discard them or
+ * refresh them with the values returned by this <code>Iterator</code>. This
+ * behavior can be avoided by calling the equivalent DOM APIs. See
+ * {@link <a HREF="package-summary.html#package_description">javax.xml.soap<a>}
+ * for more details.
+ *
+ * @param qname a <code>QName</code> object with the qname of the child
+ * elements to be returned
+ *
+ * @return an <code>Iterator</code> object over all the elements
+ * in this <code>SOAPElement</code> object with the
+ * specified qname
+ * @see SOAPElement#getChildElements(Name)
+ * @since SAAJ 1.3
+ */
+ public Iterator getChildElements(QName qname);
+
+ /**
+ * Sets the encoding style for this <code>SOAPElement</code> object
+ * to one specified.
+ *
+ * @param encodingStyle a <code>String</code> giving the encoding style
+ *
+ * @exception IllegalArgumentException if there was a problem in the
+ * encoding style being set.
+ * @exception SOAPException if setting the encodingStyle is invalid for this SOAPElement.
+ * @see #getEncodingStyle
+ */
+ public void setEncodingStyle(String encodingStyle)
+ throws SOAPException;
+ /**
+ * Returns the encoding style for this <code>SOAPElement</code> object.
+ *
+ * @return a <code>String</code> giving the encoding style
+ *
+ * @see #setEncodingStyle
+ */
+ public String getEncodingStyle();
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElementFactory.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElementFactory.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPElementFactory.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,140 @@
+/*
+ * $Id: SOAPElementFactory.java,v 1.12 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.12 $
+ * $Date: 2006/03/30 00:59:41 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package javax.xml.soap;
+
+/**
+ * <code>SOAPElementFactory</code> is a factory for XML fragments that
+ * will eventually end up in the SOAP part. These fragments
+ * can be inserted as children of the <code>SOAPHeader</code> or
+ * <code>SOAPBody</code> or <code>SOAPEnvelope</code>.
+ *
+ * <p>Elements created using this factory do not have the properties
+ * of an element that lives inside a SOAP header document. These
+ * elements are copied into the XML document tree when they are
+ * inserted.
+ * @deprecated - Use <code>javax.xml.soap.SOAPFactory</code> for creating SOAPElements.
+ * @see javax.xml.soap.SOAPFactory
+ */
+public class SOAPElementFactory {
+
+ private SOAPFactory soapFactory;
+
+ private SOAPElementFactory(SOAPFactory soapFactory) {
+ this.soapFactory = soapFactory;
+ }
+
+ /**
+ * Create a <code>SOAPElement</code> object initialized with the
+ * given <code>Name</code> object.
+ *
+ * @param name a <code>Name</code> object with the XML name for
+ * the new element
+ *
+ * @return the new <code>SOAPElement</code> object that was
+ * created
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ *
+ * @deprecated Use
+ * javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name)
+ * instead
+ *
+ * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
+ * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.namespace.QName)
+ */
+ public SOAPElement create(Name name) throws SOAPException {
+ return soapFactory.createElement(name);
+ }
+
+ /**
+ * Create a <code>SOAPElement</code> object initialized with the
+ * given local name.
+ *
+ * @param localName a <code>String</code> giving the local name for
+ * the new element
+ *
+ * @return the new <code>SOAPElement</code> object that was
+ * created
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ *
+ * @deprecated Use
+ * javax.xml.soap.SOAPFactory.createElement(String localName) instead
+ *
+ * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
+ */
+ public SOAPElement create(String localName) throws SOAPException {
+ return soapFactory.createElement(localName);
+ }
+
+ /**
+ * Create a new <code>SOAPElement</code> object with the given
+ * local name, prefix and uri.
+ *
+ * @param localName a <code>String</code> giving the local name
+ * for the new element
+ * @param prefix the prefix for this <code>SOAPElement</code>
+ * @param uri a <code>String</code> giving the URI of the
+ * namespace to which the new element belongs
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ *
+ * @deprecated Use
+ * javax.xml.soap.SOAPFactory.createElement(String localName,
+ * String prefix,
+ * String uri)
+ * instead
+ *
+ * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public SOAPElement create(String localName, String prefix, String uri)
+ throws SOAPException {
+ return soapFactory.createElement(localName, prefix, uri);
+ }
+
+ /**
+ * Creates a new instance of <code>SOAPElementFactory</code>.
+ *
+ * @return a new instance of a <code>SOAPElementFactory</code>
+ *
+ * @exception SOAPException if there was an error creating the
+ * default <code>SOAPElementFactory</code>
+ */
+ public static SOAPElementFactory newInstance() throws SOAPException {
+ try {
+ return new SOAPElementFactory(SOAPFactory.newInstance());
+ } catch (Exception ex) {
+ throw new SOAPException(
+ "Unable to create SOAP Element Factory: " + ex.getMessage());
+ }
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPEnvelope.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPEnvelope.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPEnvelope.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,202 @@
+/*
+ * $Id: SOAPEnvelope.java,v 1.7 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.7 $
+ * $Date: 2006/03/30 00:59:41 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+
+/**
+ * The container for the SOAPHeader and SOAPBody portions of a
+ * <code>SOAPPart</code> object. By default, a <code>SOAPMessage</code>
+ * object is created with a <code>SOAPPart</code> object that has a
+ * <code>SOAPEnvelope</code> object. The <code>SOAPEnvelope</code> object
+ * by default has an empty <code>SOAPBody</code> object and an empty
+ * <code>SOAPHeader</code> object. The <code>SOAPBody</code> object is
+ * required, and the <code>SOAPHeader</code> object, though
+ * optional, is used in the majority of cases. If the
+ * <code>SOAPHeader</code> object is not needed, it can be deleted,
+ * which is shown later.
+ * <P>
+ * A client can access the <code>SOAPHeader</code> and <code>SOAPBody</code>
+ * objects by calling the methods <code>SOAPEnvelope.getHeader</code> and
+ * <code>SOAPEnvelope.getBody</code>. The
+ * following lines of code use these two methods after starting with
+ * the <code>SOAPMessage</code>
+ * object <i>message</i> to get the <code>SOAPPart</code> object <i>sp</i>,
+ * which is then used to get the <code>SOAPEnvelope</code> object <i>se</i>.
+ *
+ * <PRE>
+ * SOAPPart sp = message.getSOAPPart();
+ * SOAPEnvelope se = sp.getEnvelope();
+ * SOAPHeader sh = se.getHeader();
+ * SOAPBody sb = se.getBody();
+ * </PRE>
+ * <P>
+ * It is possible to change the body or header of a <code>SOAPEnvelope</code>
+ * object by retrieving the current one, deleting it, and then adding
+ * a new body or header. The <code>javax.xml.soap.Node</code> method
+ * <code>deleteNode</code> deletes the XML element (node) on which it is
+ * called. For example, the following line of code deletes the
+ * <code>SOAPBody</code> object that is retrieved by the method <code>getBody</code>.
+ * <PRE>
+ * se.getBody().detachNode();
+ * </PRE>
+ * To create a <code>SOAPHeader</code> object to replace the one that was removed,
+ * a client uses
+ * the method <code>SOAPEnvelope.addHeader</code>, which creates a new header and
+ * adds it to the <code>SOAPEnvelope</code> object. Similarly, the method
+ * <code>addBody</code> creates a new <code>SOAPBody</code> object and adds
+ * it to the <code>SOAPEnvelope</code> object. The following code fragment
+ * retrieves the current header, removes it, and adds a new one. Then
+ * it retrieves the current body, removes it, and adds a new one.
+ *
+ * <PRE>
+ * SOAPPart sp = message.getSOAPPart();
+ * SOAPEnvelope se = sp.getEnvelope();
+ * se.getHeader().detachNode();
+ * SOAPHeader sh = se.addHeader();
+ * se.getBody().detachNode();
+ * SOAPBody sb = se.addBody();
+ * </PRE>
+ * It is an error to add a <code>SOAPBody</code> or <code>SOAPHeader</code>
+ * object if one already exists.
+ * <P>
+ * The <code>SOAPEnvelope</code> interface provides three methods for creating
+ * <code>Name</code> objects. One method creates <code>Name</code> objects with
+ * a local name, a namespace prefix, and a namesapce URI. The second method creates
+ * <code>Name</code> objects with a local name and a namespace prefix, and the third
+ * creates <code>Name</code> objects with just a local name. The following line of
+ * code, in which <i>se</i> is a <code>SOAPEnvelope</code> object, creates a new
+ * <code>Name</code> object with all three.
+ * <PRE>
+ * Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ * "http://www.wombat.org/trader");
+ * </PRE>
+ */
+public interface SOAPEnvelope extends SOAPElement {
+
+ /**
+ * Creates a new <code>Name</code> object initialized with the
+ * given local name, namespace prefix, and namespace URI.
+ * <P>
+ * This factory method creates <code>Name</code> objects for use in
+ * the SOAP/XML document.
+ *
+ * @param localName a <code>String</code> giving the local name
+ * @param prefix a <code>String</code> giving the prefix of the namespace
+ * @param uri a <code>String</code> giving the URI of the namespace
+ * @return a <code>Name</code> object initialized with the given
+ * local name, namespace prefix, and namespace URI
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract Name createName(String localName, String prefix,
+ String uri)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>Name</code> object initialized with the
+ * given local name.
+ * <P>
+ * This factory method creates <code>Name</code> objects for use in
+ * the SOAP/XML document.
+ *
+ * @param localName a <code>String</code> giving the local name
+ * @return a <code>Name</code> object initialized with the given
+ * local name
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract Name createName(String localName)
+ throws SOAPException;
+
+ /**
+ * Returns the <code>SOAPHeader</code> object for
+ * this <code>SOAPEnvelope</code> object.
+ * <P>
+ * A new <code>SOAPMessage</code> object is by default created with a
+ * <code>SOAPEnvelope</code> object that contains an empty
+ * <code>SOAPHeader</code> object. As a result, the method
+ * <code>getHeader</code> will always return a <code>SOAPHeader</code>
+ * object unless the header has been removed and a new one has not
+ * been added.
+ *
+ * @return the <code>SOAPHeader</code> object or <code>null</code> if
+ * there is none
+ * @exception SOAPException if there is a problem obtaining the
+ * <code>SOAPHeader</code> object
+ */
+ public SOAPHeader getHeader() throws SOAPException;
+
+ /**
+ * Returns the <code>SOAPBody</code> object associated with this
+ * <code>SOAPEnvelope</code> object.
+ * <P>
+ * A new <code>SOAPMessage</code> object is by default created with a
+ * <code>SOAPEnvelope</code> object that contains an empty
+ * <code>SOAPBody</code> object. As a result, the method
+ * <code>getBody</code> will always return a <code>SOAPBody</code>
+ * object unless the body has been removed and a new one has not
+ * been added.
+ *
+ * @return the <code>SOAPBody</code> object for this
+ * <code>SOAPEnvelope</code> object or <code>null</code>
+ * if there is none
+ * @exception SOAPException if there is a problem obtaining the
+ * <code>SOAPBody</code> object
+ */
+ public SOAPBody getBody() throws SOAPException;
+ /**
+ * Creates a <code>SOAPHeader</code> object and sets it as the
+ * <code>SOAPHeader</code> object for this <code>SOAPEnvelope</code>
+ * object.
+ * <P>
+ * It is illegal to add a header when the envelope already
+ * contains a header. Therefore, this method should be called
+ * only after the existing header has been removed.
+ *
+ * @return the new <code>SOAPHeader</code> object
+ *
+ * @exception SOAPException if this
+ * <code>SOAPEnvelope</code> object already contains a
+ * valid <code>SOAPHeader</code> object
+ */
+ public SOAPHeader addHeader() throws SOAPException;
+ /**
+ * Creates a <code>SOAPBody</code> object and sets it as the
+ * <code>SOAPBody</code> object for this <code>SOAPEnvelope</code>
+ * object.
+ * <P>
+ * It is illegal to add a body when the envelope already
+ * contains a body. Therefore, this method should be called
+ * only after the existing body has been removed.
+ *
+ * @return the new <code>SOAPBody</code> object
+ *
+ * @exception SOAPException if this
+ * <code>SOAPEnvelope</code> object already contains a
+ * valid <code>SOAPBody</code> object
+ */
+ public SOAPBody addBody() throws SOAPException;
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPException.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPException.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPException.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,165 @@
+/*
+ * $Id: SOAPException.java,v 1.7 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.7 $
+ * $Date: 2006/03/30 00:59:41 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * An exception that signals that a SOAP exception has occurred. A
+ * <code>SOAPException</code> object may contain a <code>String</code>
+ * that gives the reason for the exception, an embedded
+ * <code>Throwable</code> object, or both. This class provides methods
+ * for retrieving reason messages and for retrieving the embedded
+ * <code>Throwable</code> object.
+ *
+ * <P> Typical reasons for throwing a <code>SOAPException</code>
+ * object are problems such as difficulty setting a header, not being
+ * able to send a message, and not being able to get a connection with
+ * the provider. Reasons for embedding a <code>Throwable</code>
+ * object include problems such as input/output errors or a parsing
+ * problem, such as an error in parsing a header.
+ */
+public class SOAPException extends Exception {
+ private Throwable cause;
+
+ /**
+ * Constructs a <code>SOAPException</code> object with no
+ * reason or embedded <code>Throwable</code> object.
+ */
+ public SOAPException() {
+ super();
+ this.cause = null;
+ }
+
+ /**
+ * Constructs a <code>SOAPException</code> object with the given
+ * <code>String</code> as the reason for the exception being thrown.
+ *
+ * @param reason a description of what caused the exception
+ */
+ public SOAPException(String reason) {
+ super(reason);
+ this.cause = null;
+ }
+
+ /**
+ * Constructs a <code>SOAPException</code> object with the given
+ * <code>String</code> as the reason for the exception being thrown
+ * and the given <code>Throwable</code> object as an embedded
+ * exception.
+ *
+ * @param reason a description of what caused the exception
+ * @param cause a <code>Throwable</code> object that is to
+ * be embedded in this <code>SOAPException</code> object
+ */
+ public SOAPException(String reason, Throwable cause) {
+ super(reason);
+ initCause(cause);
+ }
+
+ /**
+ * Constructs a <code>SOAPException</code> object initialized
+ * with the given <code>Throwable</code> object.
+ */
+ public SOAPException(Throwable cause) {
+ super(cause.toString());
+ initCause(cause);
+ }
+
+ /**
+ * Returns the detail message for this <code>SOAPException</code>
+ * object.
+ * <P>
+ * If there is an embedded <code>Throwable</code> object, and if the
+ * <code>SOAPException</code> object has no detail message of its
+ * own, this method will return the detail message from the embedded
+ * <code>Throwable</code> object.
+ *
+ * @return the error or warning message for this
+ * <code>SOAPException</code> or, if it has none, the
+ * message of the embedded <code>Throwable</code> object,
+ * if there is one
+ */
+ public String getMessage() {
+ String message = super.getMessage();
+ if (message == null && cause != null) {
+ return cause.getMessage();
+ } else {
+ return message;
+ }
+ }
+
+ /**
+ * Returns the <code>Throwable</code> object embedded in this
+ * <code>SOAPException</code> if there is one. Otherwise, this method
+ * returns <code>null</code>.
+ *
+ * @return the embedded <code>Throwable</code> object or <code>null</code>
+ * if there is none
+ */
+
+ public Throwable getCause() {
+ return cause;
+ }
+
+ /**
+ * Initializes the <code>cause</code> field of this <code>SOAPException</code>
+ * object with the given <code>Throwable</code> object.
+ * <P>
+ * This method can be called at most once. It is generally called from
+ * within the constructor or immediately after the constructor has
+ * returned a new <code>SOAPException</code> object.
+ * If this <code>SOAPException</code> object was created with the
+ * constructor {@link #SOAPException(Throwable)} or
+ * {@link #SOAPException(String,Throwable)}, meaning that its
+ * <code>cause</code> field already has a value, this method cannot be
+ * called even once.
+ *
+ * @param cause the <code>Throwable</code> object that caused this
+ * <code>SOAPException</code> object to be thrown. The value of this
+ * parameter is saved for later retrieval by the
+ * {@link #getCause()} method. A <tt>null</tt> value is
+ * permitted and indicates that the cause is nonexistent or
+ * unknown.
+ * @return a reference to this <code>SOAPException</code> instance
+ * @throws IllegalArgumentException if <code>cause</code> is this
+ * <code>Throwable</code> object. (A <code>Throwable</code> object
+ * cannot be its own cause.)
+ * @throws IllegalStateException if the cause for this <code>SOAPException</code> object
+ * has already been initialized
+ */
+ public synchronized Throwable initCause(Throwable cause) {
+ if (this.cause != null) {
+ throw new IllegalStateException("Can't override cause");
+ }
+ if (cause == this) {
+ throw new IllegalArgumentException("Self-causation not permitted");
+ }
+ this.cause = cause;
+
+ return this;
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFactory.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFactory.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFactory.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,295 @@
+/*
+ * $Id: SOAPFactory.java,v 1.14 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.14 $
+ * $Datae$
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package javax.xml.soap;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+/**
+ * <code>SOAPFactory</code> is a factory for creating various objects
+ * that exist in the SOAP XML tree.
+
+ * <code>SOAPFactory</code> can be
+ * used to create XML fragments that will eventually end up in the
+ * SOAP part. These fragments can be inserted as children of the
+ * {@link SOAPHeaderElement} or {@link SOAPBodyElement} or
+ * {@link SOAPEnvelope} or other {@link SOAPElement} objects.
+ *
+ * <code>SOAPFactory</code> also has methods to create
+ * <code>javax.xml.soap.Detail</code> objects as well as
+ * <code>java.xml.soap.Name</code> objects.
+ *
+ */
+public abstract class SOAPFactory {
+
+ /**
+ * A constant representing the property used to lookup the name of
+ * a <code>SOAPFactory</code> implementation class.
+ */
+ static private final String SOAP_FACTORY_PROPERTY =
+ "javax.xml.soap.SOAPFactory";
+
+ /**
+ * Creates a <code>SOAPElement</code> object from an existing DOM
+ * <code>Element</code>. If the DOM <code>Element</code> that is passed in
+ * as an argument is already a <code>SOAPElement</code> then this method
+ * must return it unmodified without any further work. Otherwise, a new
+ * <code>SOAPElement</code> is created and a deep copy is made of the
+ * <code>domElement</code> argument. The concrete type of the return value
+ * will depend on the name of the <code>domElement</code> argument. If any
+ * part of the tree rooted in <code>domElement</code> violates SOAP rules, a
+ * <code>SOAPException</code> will be thrown.
+ *
+ * @param domElement - the <code>Element</code> to be copied.
+ *
+ * @return a new <code>SOAPElement</code> that is a copy of <code>domElement</code>.
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ *
+ * @since SAAJ 1.3
+ */
+ public SOAPElement createElement(Element domElement) throws SOAPException {
+ throw new UnsupportedOperationException("createElement(org.w3c.dom.Element) must be overridden by all subclasses of SOAPFactory.");
+ }
+
+ /**
+ * Creates a <code>SOAPElement</code> object initialized with the
+ * given <code>Name</code> object. The concrete type of the return value
+ * will depend on the name given to the new <code>SOAPElement</code>. For
+ * instance, a new <code>SOAPElement</code> with the name
+ * "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a
+ * <code>SOAPEnvelope</code> that supports SOAP 1.2 behavior to be created.
+ *
+ * @param name a <code>Name</code> object with the XML name for
+ * the new element
+ *
+ * @return the new <code>SOAPElement</code> object that was
+ * created
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ * @see SOAPFactory#createElement(javax.xml.namespace.QName)
+ */
+ public abstract SOAPElement createElement(Name name) throws SOAPException;
+
+ /**
+ * Creates a <code>SOAPElement</code> object initialized with the
+ * given <code>QName</code> object. The concrete type of the return value
+ * will depend on the name given to the new <code>SOAPElement</code>. For
+ * instance, a new <code>SOAPElement</code> with the name
+ * "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a
+ * <code>SOAPEnvelope</code> that supports SOAP 1.2 behavior to be created.
+ *
+ * @param qname a <code>QName</code> object with the XML name for
+ * the new element
+ *
+ * @return the new <code>SOAPElement</code> object that was
+ * created
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ * @see SOAPFactory#createElement(Name)
+ * @since SAAJ 1.3
+ */
+ public SOAPElement createElement(QName qname) throws SOAPException {
+ throw new UnsupportedOperationException("createElement(QName) must be overridden by all subclasses of SOAPFactory.");
+ }
+
+ /**
+ * Creates a <code>SOAPElement</code> object initialized with the
+ * given local name.
+ *
+ * @param localName a <code>String</code> giving the local name for
+ * the new element
+ *
+ * @return the new <code>SOAPElement</code> object that was
+ * created
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ */
+ public abstract SOAPElement createElement(String localName)
+ throws SOAPException;
+
+
+ /**
+ * Creates a new <code>SOAPElement</code> object with the given
+ * local name, prefix and uri. The concrete type of the return value
+ * will depend on the name given to the new <code>SOAPElement</code>. For
+ * instance, a new <code>SOAPElement</code> with the name
+ * "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a
+ * <code>SOAPEnvelope</code> that supports SOAP 1.2 behavior to be created.
+ *
+ * @param localName a <code>String</code> giving the local name
+ * for the new element
+ * @param prefix the prefix for this <code>SOAPElement</code>
+ * @param uri a <code>String</code> giving the URI of the
+ * namespace to which the new element belongs
+ *
+ * @exception SOAPException if there is an error in creating the
+ * <code>SOAPElement</code> object
+ */
+ public abstract SOAPElement createElement(
+ String localName,
+ String prefix,
+ String uri)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>Detail</code> object which serves as a container
+ * for <code>DetailEntry</code> objects.
+ * <P>
+ * This factory method creates <code>Detail</code> objects for use in
+ * situations where it is not practical to use the <code>SOAPFault</code>
+ * abstraction.
+ *
+ * @return a <code>Detail</code> object
+ * @throws SOAPException if there is a SOAP error
+ * @throws UnsupportedOperationException if the protocol specified
+ * for the SOAPFactory was <code>DYNAMIC_SOAP_PROTOCOL</code>
+ */
+ public abstract Detail createDetail() throws SOAPException;
+
+ /**
+ *Creates a new <code>SOAPFault</code> object initialized with the given <code>reasonText</code>
+ * and <code>faultCode</code>
+ *@param reasonText the ReasonText/FaultString for the fault
+ *@param faultCode the FaultCode for the fault
+ *@return a <code>SOAPFault</code> object
+ *@throws SOAPException if there is a SOAP error
+ *@since SAAJ 1.3
+ */
+ public abstract SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException;
+
+ /**
+ *Creates a new default <code>SOAPFault</code> object
+ *@return a <code>SOAPFault</code> object
+ *@throws SOAPException if there is a SOAP error
+ *@since SAAJ 1.3
+ */
+ public abstract SOAPFault createFault() throws SOAPException;
+
+ /**
+ * Creates a new <code>Name</code> object initialized with the
+ * given local name, namespace prefix, and namespace URI.
+ * <P>
+ * This factory method creates <code>Name</code> objects for use in
+ * situations where it is not practical to use the <code>SOAPEnvelope</code>
+ * abstraction.
+ *
+ * @param localName a <code>String</code> giving the local name
+ * @param prefix a <code>String</code> giving the prefix of the namespace
+ * @param uri a <code>String</code> giving the URI of the namespace
+ * @return a <code>Name</code> object initialized with the given
+ * local name, namespace prefix, and namespace URI
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract Name createName(
+ String localName,
+ String prefix,
+ String uri)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>Name</code> object initialized with the
+ * given local name.
+ * <P>
+ * This factory method creates <code>Name</code> objects for use in
+ * situations where it is not practical to use the <code>SOAPEnvelope</code>
+ * abstraction.
+ *
+ * @param localName a <code>String</code> giving the local name
+ * @return a <code>Name</code> object initialized with the given
+ * local name
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract Name createName(String localName) throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPFactory</code> object that is an instance of
+ * the default implementation (SOAP 1.1),
+ *
+ * This method uses the following ordered lookup procedure to determine the SOAPFactory implementation class to load:
+ * <UL>
+ * <LI> Use the javax.xml.soap.SOAPFactory system property.
+ * <LI> Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard
+ * java.util.Properties format and contains the fully qualified name of the implementation class with the key being the
+ * system property defined above.
+ * <LI> Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API
+ * will look for a classname in the file META-INF/services/javax.xml.soap.SOAPFactory in jars available to the runtime.
+ * <LI> Use the SAAJMetaFactory instance to locate the SOAPFactory implementation class.
+ * </UL>
+ *
+ * @return a new instance of a <code>SOAPFactory</code>
+ *
+ * @exception SOAPException if there was an error creating the
+ * default <code>SOAPFactory</code>
+ * @see SAAJMetaFactory
+ */
+ public static SOAPFactory newInstance()
+ throws SOAPException
+ {
+ try {
+ SOAPFactory factory = (SOAPFactory) FactoryFinder.find(SOAP_FACTORY_PROPERTY);
+ if (factory != null)
+ return factory;
+ return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+ } catch (Exception ex) {
+ throw new SOAPException(
+ "Unable to create SOAP Factory: " + ex.getMessage());
+ }
+
+ }
+
+ /**
+ * Creates a new <code>SOAPFactory</code> object that is an instance of
+ * the specified implementation, this method uses the SAAJMetaFactory to
+ * locate the implementation class and create the SOAPFactory instance.
+ *
+ * @return a new instance of a <code>SOAPFactory</code>
+ *
+ * @param protocol a string constant representing the protocol of the
+ * specified SOAP factory implementation. May be
+ * either <code>DYNAMIC_SOAP_PROTOCOL</code>,
+ * <code>DEFAULT_SOAP_PROTOCOL</code> (which is the same
+ * as) <code>SOAP_1_1_PROTOCOL</code>, or
+ * <code>SOAP_1_2_PROTOCOL</code>.
+ *
+ * @exception SOAPException if there was an error creating the
+ * specified <code>SOAPFactory</code>
+ * @see SAAJMetaFactory
+ * @since SAAJ 1.3
+ */
+ public static SOAPFactory newInstance(String protocol)
+ throws SOAPException {
+ return SAAJMetaFactory.getInstance().newSOAPFactory(protocol);
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFault.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFault.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFault.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,513 @@
+/*
+ * $Id: SOAPFault.java,v 1.21 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.21 $
+ * $Date: 2006/03/30 00:59:41 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+import java.util.Locale;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An element in the <code>SOAPBody</code> object that contains
+ * error and/or status information. This information may relate to
+ * errors in the <code>SOAPMessage</code> object or to problems
+ * that are not related to the content in the message itself. Problems
+ * not related to the message itself are generally errors in
+ * processing, such as the inability to communicate with an upstream
+ * server.
+ * <P>
+ * Depending on the <code>protocol</code> specified while creating the
+ * <code>MessageFactory</code> instance, a <code>SOAPFault</code> has
+ * sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification.
+ */
+public interface SOAPFault extends SOAPBodyElement {
+
+ /**
+ * Sets this <code>SOAPFault</code> object with the given fault code.
+ *
+ * <P> Fault codes, which give information about the fault, are defined
+ * in the SOAP 1.1 specification. A fault code is mandatory and must
+ * be of type <code>Name</code>. This method provides a convenient
+ * way to set a fault code. For example,
+ *
+ * <PRE>
+ * SOAPEnvelope se = ...;
+ * // Create a qualified name in the SOAP namespace with a localName
+ * // of "Client". Note that prefix parameter is optional and is null
+ * // here which causes the implementation to use an appropriate prefix.
+ * Name qname = se.createName("Client", null,
+ * SOAPConstants.URI_NS_SOAP_ENVELOPE);
+ * SOAPFault fault = ...;
+ * fault.setFaultCode(qname);
+ * </PRE>
+ * It is preferable to use this method over {@link #setFaultCode(String)}.
+ *
+ * @param faultCodeQName a <code>Name</code> object giving the fault
+ * code to be set. It must be namespace qualified.
+ * @see #getFaultCodeAsName
+ *
+ * @exception SOAPException if there was an error in adding the
+ * <i>faultcode</i> element to the underlying XML tree.
+ *
+ * @since SAAJ 1.2
+ */
+ public void setFaultCode(Name faultCodeQName) throws SOAPException;
+
+ /**
+ * Sets this <code>SOAPFault</code> object with the given fault code.
+ *
+ * It is preferable to use this method over {@link #setFaultCode(Name)}.
+ *
+ * @param faultCodeQName a <code>QName</code> object giving the fault
+ * code to be set. It must be namespace qualified.
+ * @see #getFaultCodeAsQName
+ *
+ * @exception SOAPException if there was an error in adding the
+ * <code>faultcode</code> element to the underlying XML tree.
+ *
+ * @see #setFaultCode(Name)
+ * @see #getFaultCodeAsQName()
+ *
+ * @since SAAJ 1.3
+ */
+ public void setFaultCode(QName faultCodeQName) throws SOAPException;
+
+ /**
+ * Sets this <code>SOAPFault</code> object with the give fault code.
+ * <P>
+ * Fault codes, which given information about the fault, are defined in
+ * the SOAP 1.1 specification. This element is mandatory in SOAP 1.1.
+ * Because the fault code is required to be a QName it is preferable to
+ * use the {@link #setFaultCode(Name)} form of this method.
+ *
+ * @param faultCode a <code>String</code> giving the fault code to be set.
+ * It must be of the form "prefix:localName" where the prefix has
+ * been defined in a namespace declaration.
+ * @see #setFaultCode(Name)
+ * @see #getFaultCode
+ * @see SOAPElement#addNamespaceDeclaration
+ *
+ * @exception SOAPException if there was an error in adding the
+ * <code>faultCode</code> to the underlying XML tree.
+ */
+ public void setFaultCode(String faultCode) throws SOAPException;
+
+ /**
+ * Gets the mandatory SOAP 1.1 fault code for this
+ * <code>SOAPFault</code> object as a SAAJ <code>Name</code> object.
+ * The SOAP 1.1 specification requires the value of the "faultcode"
+ * element to be of type QName. This method returns the content of the
+ * element as a QName in the form of a SAAJ Name object. This method
+ * should be used instead of the <code>getFaultCode</code> method since
+ * it allows applications to easily access the namespace name without
+ * additional parsing.
+ *
+ * @return a <code>Name</code> representing the faultcode
+ * @see #setFaultCode(Name)
+ *
+ * @since SAAJ 1.2
+ */
+ public Name getFaultCodeAsName();
+
+
+ /**
+ * Gets the fault code for this
+ * <code>SOAPFault</code> object as a <code>QName</code> object.
+ *
+ * @return a <code>QName</code> representing the faultcode
+ *
+ * @see #setFaultCode(QName)
+ *
+ * @since SAAJ 1.3
+ */
+ public QName getFaultCodeAsQName();
+
+ /**
+ * Gets the Subcodes for this <code>SOAPFault</code> as an iterator over
+ * <code>QNames</code>.
+ *
+ * @return an <code>Iterator</code> that accesses a sequence of
+ * <code>QNames</code>. This <code>Iterator</code> should not support
+ * the optional <code>remove</code> method. The order in which the
+ * Subcodes are returned reflects the hierarchy of Subcodes present
+ * in the fault from top to bottom.
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Subcode.
+ *
+ * @since SAAJ 1.3
+ */
+ public Iterator getFaultSubcodes();
+
+ /**
+ * Removes any Subcodes that may be contained by this
+ * <code>SOAPFault</code>. Subsequent calls to
+ * <code>getFaultSubcodes</code> will return an empty iterator until a call
+ * to <code>appendFaultSubcode</code> is made.
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Subcode.
+ *
+ * @since SAAJ 1.3
+ */
+ public void removeAllFaultSubcodes();
+
+ /**
+ * Adds a Subcode to the end of the sequence of Subcodes contained by this
+ * <code>SOAPFault</code>. Subcodes, which were introduced in SOAP 1.2, are
+ * represented by a recursive sequence of subelements rooted in the
+ * mandatory Code subelement of a SOAP Fault.
+ *
+ * @param subcode a QName containing the Value of the Subcode.
+ *
+ * @exception SOAPException if there was an error in setting the Subcode
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Subcode.
+ *
+ * @since SAAJ 1.3
+ */
+ public void appendFaultSubcode(QName subcode) throws SOAPException;
+
+ /**
+ * Gets the fault code for this <code>SOAPFault</code> object.
+ *
+ * @return a <code>String</code> with the fault code
+ * @see #getFaultCodeAsName
+ * @see #setFaultCode
+ */
+ public String getFaultCode();
+
+ /**
+ * Sets this <code>SOAPFault</code> object with the given fault actor.
+ * <P>
+ * The fault actor is the recipient in the message path who caused the
+ * fault to happen.
+ * <P>
+ * If this <code>SOAPFault</code> supports SOAP 1.2 then this call is
+ * equivalent to {@link #setFaultRole(String)}
+ *
+ * @param faultActor a <code>String</code> identifying the actor that
+ * caused this <code>SOAPFault</code> object
+ * @see #getFaultActor
+ *
+ * @exception SOAPException if there was an error in adding the
+ * <code>faultActor</code> to the underlying XML tree.
+ */
+ public void setFaultActor(String faultActor) throws SOAPException;
+
+ /**
+ * Gets the fault actor for this <code>SOAPFault</code> object.
+ * <P>
+ * If this <code>SOAPFault</code> supports SOAP 1.2 then this call is
+ * equivalent to {@link #getFaultRole()}
+ *
+ * @return a <code>String</code> giving the actor in the message path
+ * that caused this <code>SOAPFault</code> object
+ * @see #setFaultActor
+ */
+ public String getFaultActor();
+
+ /**
+ * Sets the fault string for this <code>SOAPFault</code> object
+ * to the given string.
+ * <P>
+ * If this
+ * <code>SOAPFault</code> is part of a message that supports SOAP 1.2 then
+ * this call is equivalent to:
+ * <pre>
+ * addFaultReasonText(faultString, Locale.getDefault());
+ * </pre>
+ *
+ * @param faultString a <code>String</code> giving an explanation of
+ * the fault
+ * @see #getFaultString
+ *
+ * @exception SOAPException if there was an error in adding the
+ * <code>faultString</code> to the underlying XML tree.
+ */
+ public void setFaultString(String faultString) throws SOAPException;
+
+ /**
+ * Sets the fault string for this <code>SOAPFault</code> object
+ * to the given string and localized to the given locale.
+ * <P>
+ * If this
+ * <code>SOAPFault</code> is part of a message that supports SOAP 1.2 then
+ * this call is equivalent to:
+ * <pre>
+ * addFaultReasonText(faultString, locale);
+ * </pre>
+ *
+ * @param faultString a <code>String</code> giving an explanation of
+ * the fault
+ * @param locale a {@link java.util.Locale Locale} object indicating
+ * the native language of the <code>faultString</code>
+ * @see #getFaultString
+ *
+ * @exception SOAPException if there was an error in adding the
+ * <code>faultString</code> to the underlying XML tree.
+ *
+ * @since SAAJ 1.2
+ */
+ public void setFaultString(String faultString, Locale locale)
+ throws SOAPException;
+
+ /**
+ * Gets the fault string for this <code>SOAPFault</code> object.
+ * <P>
+ * If this
+ * <code>SOAPFault</code> is part of a message that supports SOAP 1.2 then
+ * this call is equivalent to:
+ * <pre>
+ * String reason = null;
+ * try {
+ * reason = (String) getFaultReasonTexts().next();
+ * } catch (SOAPException e) {}
+ * return reason;
+ * </pre>
+ *
+ * @return a <code>String</code> giving an explanation of
+ * the fault
+ * @see #setFaultString(String)
+ * @see #setFaultString(String, Locale)
+ */
+ public String getFaultString();
+
+ /**
+ * Gets the locale of the fault string for this <code>SOAPFault</code>
+ * object.
+ * <P>
+ * If this
+ * <code>SOAPFault</code> is part of a message that supports SOAP 1.2 then
+ * this call is equivalent to:
+ * <pre>
+ * Locale locale = null;
+ * try {
+ * locale = (Locale) getFaultReasonLocales().next();
+ * } catch (SOAPException e) {}
+ * return locale;
+ * </pre>
+ *
+ * @return a <code>Locale</code> object indicating the native language of
+ * the fault string or <code>null</code> if no locale was specified
+ * @see #setFaultString(String, Locale)
+ *
+ * @since SAAJ 1.2
+ */
+ public Locale getFaultStringLocale();
+
+ /**
+ * Returns true if this <code>SOAPFault</code> has a <code>Detail</code>
+ * subelement and false otherwise. Equivalent to
+ * <code>(getDetail()!=null)</code>.
+ *
+ * @return true if this <code>SOAPFault</code> has a <code>Detail</code>
+ * subelement and false otherwise.
+ *
+ * @since SAAJ 1.3
+ */
+ public boolean hasDetail();
+
+ /**
+ * Returns the optional detail element for this <code>SOAPFault</code>
+ * object.
+ * <P>
+ * A <code>Detail</code> object carries application-specific error
+ * information, the scope of the error information is restricted to
+ * faults in the <code>SOAPBodyElement</code> objects if this is a
+ * SOAP 1.1 Fault.
+ *
+ * @return a <code>Detail</code> object with application-specific
+ * error information if present, null otherwise
+ */
+ public Detail getDetail();
+
+ /**
+ * Creates an optional <code>Detail</code> object and sets it as the
+ * <code>Detail</code> object for this <code>SOAPFault</code>
+ * object.
+ * <P>
+ * It is illegal to add a detail when the fault already
+ * contains a detail. Therefore, this method should be called
+ * only after the existing detail has been removed.
+ *
+ * @return the new <code>Detail</code> object
+ *
+ * @exception SOAPException if this
+ * <code>SOAPFault</code> object already contains a
+ * valid <code>Detail</code> object
+ */
+ public Detail addDetail() throws SOAPException;
+
+ /**
+ * Returns an <code>Iterator</code> over a distinct sequence of
+ * <code>Locale</code>s for which there are associated Reason Text items.
+ * Any of these <code>Locale</code>s can be used in a call to
+ * <code>getFaultReasonText</code> in order to obtain a localized version
+ * of the Reason Text string.
+ *
+ * @return an <code>Iterator</code> over a sequence of <code>Locale</code>
+ * objects for which there are associated Reason Text items.
+ *
+ * @exception SOAPException if there was an error in retrieving
+ * the fault Reason locales.
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Reason.
+ *
+ * @since SAAJ 1.3
+ */
+ public Iterator getFaultReasonLocales() throws SOAPException;
+
+ /**
+ * Returns an <code>Iterator</code> over a sequence of
+ * <code>String</code> objects containing all of the Reason Text items for
+ * this <code>SOAPFault</code>.
+ *
+ * @return an <code>Iterator</code> over env:Fault/env:Reason/env:Text items.
+ *
+ * @exception SOAPException if there was an error in retrieving
+ * the fault Reason texts.
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Reason.
+ *
+ * @since SAAJ 1.3
+ */
+ public Iterator getFaultReasonTexts() throws SOAPException;
+
+ /**
+ * Returns the Reason Text associated with the given <code>Locale</code>.
+ * If more than one such Reason Text exists the first matching Text is
+ * returned
+ *
+ * @param locale -- the <code>Locale</code> for which a localized
+ * Reason Text is desired
+ *
+ * @return the Reason Text associated with <code>locale</code>
+ *
+ * @see #getFaultString
+ *
+ * @exception SOAPException if there was an error in retrieving
+ * the fault Reason text for the specified locale .
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Reason.
+ *
+ * @since SAAJ 1.3
+ */
+ public String getFaultReasonText(Locale locale) throws SOAPException;
+
+ /**
+ * Appends or replaces a Reason Text item containing the specified
+ * text message and an <i>xml:lang</i> derived from
+ * <code>locale</code>. If a Reason Text item with this
+ * <i>xml:lang</i> already exists its text value will be replaced
+ * with <code>text</code>.
+ * The <code>locale</code> parameter should not be <code>null</code>
+ * <P>
+ * Code sample:
+ *
+ * <PRE>
+ * SOAPFault fault = ...;
+ * fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);
+ * </PRE>
+ *
+ * @param text -- reason message string
+ * @param locale -- Locale object representing the locale of the message
+ *
+ * @exception SOAPException if there was an error in adding the Reason text
+ * or the <code>locale</code> passed was <code>null</code>.
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Reason.
+ *
+ * @since SAAJ 1.3
+ */
+ public void addFaultReasonText(String text, java.util.Locale locale)
+ throws SOAPException;
+
+ /**
+ * Returns the optional Node element value for this
+ * <code>SOAPFault</code> object. The Node element is
+ * optional in SOAP 1.2.
+ *
+ * @return Content of the env:Fault/env:Node element as a String
+ * or <code>null</code> if none
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Node.
+ *
+ * @since SAAJ 1.3
+ */
+ public String getFaultNode();
+
+ /**
+ * Creates or replaces any existing Node element value for
+ * this <code>SOAPFault</code> object. The Node element
+ * is optional in SOAP 1.2.
+ *
+ * @exception SOAPException if there was an error in setting the
+ * Node for this <code>SOAPFault</code> object.
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Node.
+ *
+ *
+ * @since SAAJ 1.3
+ */
+ public void setFaultNode(String uri) throws SOAPException;
+
+ /**
+ * Returns the optional Role element value for this
+ * <code>SOAPFault</code> object. The Role element is
+ * optional in SOAP 1.2.
+ *
+ * @return Content of the env:Fault/env:Role element as a String
+ * or <code>null</code> if none
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Role.
+ *
+ * @since SAAJ 1.3
+ */
+ public String getFaultRole();
+
+ /**
+ * Creates or replaces any existing Role element value for
+ * this <code>SOAPFault</code> object. The Role element
+ * is optional in SOAP 1.2.
+ *
+ * @param uri - the URI of the Role
+ *
+ * @exception SOAPException if there was an error in setting the
+ * Role for this <code>SOAPFault</code> object.
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Role.
+ *
+ * @since SAAJ 1.3
+ */
+ public void setFaultRole(String uri) throws SOAPException;
+
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFaultElement.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFaultElement.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPFaultElement.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,39 @@
+/*
+ * $Id: SOAPFaultElement.java,v 1.5 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.5 $
+ * $Date: 2006/03/30 00:59:41 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of the contents in
+ * a <code>SOAPFault</code> object. The <code>Detail</code> interface
+ * is a <code>SOAPFaultElement</code>.
+ * <P>
+ * Content is added to a <code>SOAPFaultElement</code> using the
+ * <code>SOAPElement</code> method <code>addTextNode</code>.
+ */
+public interface SOAPFaultElement extends SOAPElement {
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeader.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeader.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeader.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,266 @@
+/*
+ * $Id: SOAPHeader.java,v 1.15 2006/03/30 00:59:41 ofung Exp $
+ * $Revision: 1.15 $
+ * $Date: 2006/03/30 00:59:41 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A representation of the SOAP header
+ * element. A SOAP header element consists of XML data that affects
+ * the way the application-specific content is processed by the message
+ * provider. For example, transaction semantics, authentication information,
+ * and so on, can be specified as the content of a <code>SOAPHeader</code>
+ * object.
+ * <P>
+ * A <code>SOAPEnvelope</code> object contains an empty
+ * <code>SOAPHeader</code> object by default. If the <code>SOAPHeader</code>
+ * object, which is optional, is not needed, it can be retrieved and deleted
+ * with the following line of code. The variable <i>se</i> is a
+ * <code>SOAPEnvelope</code> object.
+ * <PRE>
+ * se.getHeader().detachNode();
+ * </PRE>
+ *
+ * A <code>SOAPHeader</code> object is created with the <code>SOAPEnvelope</code>
+ * method <code>addHeader</code>. This method, which creates a new header and adds it
+ * to the envelope, may be called only after the existing header has been removed.
+ *
+ * <PRE>
+ * se.getHeader().detachNode();
+ * SOAPHeader sh = se.addHeader();
+ * </PRE>
+ * <P>
+ * A <code>SOAPHeader</code> object can have only <code>SOAPHeaderElement</code>
+ * objects as its immediate children. The method <code>addHeaderElement</code>
+ * creates a new <code>HeaderElement</code> object and adds it to the
+ * <code>SOAPHeader</code> object. In the following line of code, the
+ * argument to the method <code>addHeaderElement</code> is a <code>Name</code>
+ * object that is the name for the new <code>HeaderElement</code> object.
+ * <PRE>
+ * SOAPHeaderElement shElement = sh.addHeaderElement(name);
+ * </PRE>
+ *
+ * @see SOAPHeaderElement
+ */
+public interface SOAPHeader extends SOAPElement {
+ /**
+ * Creates a new <code>SOAPHeaderElement</code> object initialized with the
+ * specified name and adds it to this <code>SOAPHeader</code> object.
+ *
+ * @param name a <code>Name</code> object with the name of the new
+ * <code>SOAPHeaderElement</code> object
+ * @return the new <code>SOAPHeaderElement</code> object that was
+ * inserted into this <code>SOAPHeader</code> object
+ * @exception SOAPException if a SOAP error occurs
+ * @see SOAPHeader#addHeaderElement(javax.xml.namespace.QName)
+ */
+ public SOAPHeaderElement addHeaderElement(Name name)
+ throws SOAPException;
+
+ /**
+ * Creates a new <code>SOAPHeaderElement</code> object initialized with the
+ * specified qname and adds it to this <code>SOAPHeader</code> object.
+ *
+ * @param qname a <code>QName</code> object with the qname of the new
+ * <code>SOAPHeaderElement</code> object
+ * @return the new <code>SOAPHeaderElement</code> object that was
+ * inserted into this <code>SOAPHeader</code> object
+ * @exception SOAPException if a SOAP error occurs
+ * @see SOAPHeader#addHeaderElement(Name)
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addHeaderElement(QName qname)
+ throws SOAPException;
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
+ * in this <code>SOAPHeader</code> object
+ * that have the specified <i>actor</i> and that have a MustUnderstand attribute
+ * whose value is equivalent to <code>true</code>.
+ * <p>
+ * In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>
+ * attribute, but with essentially the same semantics.
+ *
+ * @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>
+ * for which to search
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderElement</code> objects that contain the specified
+ * <code>actor</code> / <code>role</code> and are marked as MustUnderstand
+ * @see #examineHeaderElements
+ * @see #extractHeaderElements
+ * @see SOAPConstants#URI_SOAP_ACTOR_NEXT
+ *
+ * @since SAAJ 1.2
+ */
+ public Iterator examineMustUnderstandHeaderElements(String actor);
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
+ * in this <code>SOAPHeader</code> object
+ * that have the specified <i>actor</i>.
+ *
+ * An <i>actor</i> is a global attribute that indicates the intermediate
+ * parties that should process a message before it reaches its ultimate
+ * receiver. An actor receives the message and processes it before sending
+ * it on to the next actor. The default actor is the ultimate intended
+ * recipient for the message, so if no actor attribute is included in a
+ * <code>SOAPHeader</code> object, it is sent to the ultimate receiver
+ * along with the message body.
+ * <p>
+ * In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>
+ * attribute, but with essentially the same semantics.
+ *
+ * @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>
+ * for which to search
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderElement</code> objects that contain the specified
+ * <code>actor</code> / <code>role</code>
+ * @see #extractHeaderElements
+ * @see SOAPConstants#URI_SOAP_ACTOR_NEXT
+ */
+ public Iterator examineHeaderElements(String actor);
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
+ * in this <code>SOAPHeader</code> object
+ * that have the specified <i>actor</i> and detaches them
+ * from this <code>SOAPHeader</code> object.
+ * <P>
+ * This method allows an actor to process the parts of the
+ * <code>SOAPHeader</code> object that apply to it and to remove
+ * them before passing the message on to the next actor.
+ * <p>
+ * In SOAP 1.2 the <i>env:actor</i> attribute is replaced by the <i>env:role</i>
+ * attribute, but with essentially the same semantics.
+ *
+ * @param actor a <code>String</code> giving the URI of the <code>actor</code> / <code>role</code>
+ * for which to search
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderElement</code> objects that contain the specified
+ * <code>actor</code> / <code>role</code>
+ *
+ * @see #examineHeaderElements
+ * @see SOAPConstants#URI_SOAP_ACTOR_NEXT
+ */
+ public Iterator extractHeaderElements(String actor);
+
+ /**
+ * Creates a new NotUnderstood <code>SOAPHeaderElement</code> object initialized
+ * with the specified name and adds it to this <code>SOAPHeader</code> object.
+ * This operation is supported only by SOAP 1.2.
+ *
+ * @param name a <code>QName</code> object with the name of the
+ * <code>SOAPHeaderElement</code> object that was not understood.
+ * @return the new <code>SOAPHeaderElement</code> object that was
+ * inserted into this <code>SOAPHeader</code> object
+ * @exception SOAPException if a SOAP error occurs.
+ * @exception UnsupportedOperationException if this is a SOAP 1.1 Header.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addNotUnderstoodHeaderElement(QName name)
+ throws SOAPException;
+
+ /**
+ * Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized
+ * with the specified List of supported SOAP URIs and adds it to this
+ * <code>SOAPHeader</code> object.
+ * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
+ *
+ * @param supportedSOAPURIs an <code>Iterator</code> object with the URIs of SOAP
+ * versions supported.
+ * @return the new <code>SOAPHeaderElement</code> object that was
+ * inserted into this <code>SOAPHeader</code> object
+ * @exception SOAPException if a SOAP error occurs.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSOAPURIs)
+ throws SOAPException;
+
+ /**
+ * Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized
+ * with the specified array of supported SOAP URIs and adds it to this
+ * <code>SOAPHeader</code> object.
+ * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
+ *
+ * @param supportedSoapUris an array of the URIs of SOAP versions supported.
+ * @return the new <code>SOAPHeaderElement</code> object that was
+ * inserted into this <code>SOAPHeader</code> object
+ * @exception SOAPException if a SOAP error occurs.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris)
+ throws SOAPException;
+
+ /**
+ * Creates a new Upgrade <code>SOAPHeaderElement</code> object initialized
+ * with the specified supported SOAP URI and adds it to this
+ * <code>SOAPHeader</code> object.
+ * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
+ *
+ * @param supportedSoapUri the URI of SOAP the version that is supported.
+ * @return the new <code>SOAPHeaderElement</code> object that was
+ * inserted into this <code>SOAPHeader</code> object
+ * @exception SOAPException if a SOAP error occurs.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri)
+ throws SOAPException;
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
+ * in this <code>SOAPHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderElement</code> objects contained by this
+ * <code>SOAPHeader</code>
+ * @see #extractAllHeaderElements
+ *
+ * @since SAAJ 1.2
+ */
+ public Iterator examineAllHeaderElements();
+
+ /**
+ * Returns an <code>Iterator</code> over all the <code>SOAPHeaderElement</code> objects
+ * in this <code>SOAPHeader</code> object and detaches them
+ * from this <code>SOAPHeader</code> object.
+ *
+ * @return an <code>Iterator</code> object over all the
+ * <code>SOAPHeaderElement</code> objects contained by this
+ * <code>SOAPHeader</code>
+ *
+ * @see #examineAllHeaderElements
+ *
+ * @since SAAJ 1.2
+ */
+ public Iterator extractAllHeaderElements();
+
+}
+
+
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeaderElement.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeaderElement.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,168 @@
+/*
+ * $Id: SOAPHeaderElement.java,v 1.10 2006/03/30 00:59:42 ofung Exp $
+ * $Revision: 1.10 $
+ * $Date: 2006/03/30 00:59:42 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * An object representing the contents in the SOAP header part of the
+ * SOAP envelope.
+ * The immediate children of a <code>SOAPHeader</code> object can
+ * be represented only as <code>SOAPHeaderElement</code> objects.
+ * <P>
+ * A <code>SOAPHeaderElement</code> object can have other
+ * <code>SOAPElement</code> objects as its children.
+ */
+public interface SOAPHeaderElement extends SOAPElement {
+
+ /**
+ * Sets the actor associated with this <code>SOAPHeaderElement</code>
+ * object to the specified actor. The default value of an actor is:
+ * <code>SOAPConstants.URI_SOAP_ACTOR_NEXT</code>
+ * <P>
+ * If this <code>SOAPHeaderElement</code> supports SOAP 1.2 then this call is
+ * equivalent to {@link #setRole(String)}
+ *
+ * @param actorURI a <code>String</code> giving the URI of the actor
+ * to set
+ *
+ * @exception IllegalArgumentException if there is a problem in
+ * setting the actor.
+ *
+ * @see #getActor
+ */
+ public void setActor(String actorURI);
+
+ /**
+ * Sets the <code>Role</code> associated with this <code>SOAPHeaderElement</code>
+ * object to the specified <code>Role</code>.
+ *
+ * @param uri - the URI of the <code>Role</code>
+ *
+ * @throws SOAPException if there is an error in setting the role
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Role.
+ *
+ * @since SAAJ 1.3
+ */
+ public void setRole(String uri) throws SOAPException;
+
+ /**
+ * Returns the uri of the <i>actor</i> attribute of this
+ * <code>SOAPHeaderElement</code>.
+ *<P>
+ * If this <code>SOAPHeaderElement</code> supports SOAP 1.2 then this call is
+ * equivalent to {@link #getRole()}
+ * @return a <code>String</code> giving the URI of the actor
+ * @see #setActor
+ */
+ public String getActor();
+
+ /**
+ * Returns the value of the <i>Role</i> attribute of this
+ * <code>SOAPHeaderElement</code>.
+ *
+ * @return a <code>String</code> giving the URI of the <code>Role</code>
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Fault Role.
+ *
+ * @since SAAJ 1.3
+ */
+ public String getRole();
+
+ /**
+ * Sets the mustUnderstand attribute for this <code>SOAPHeaderElement</code>
+ * object to be either true or false.
+ * <P>
+ * If the mustUnderstand attribute is on, the actor who receives the
+ * <code>SOAPHeaderElement</code> must process it correctly. This
+ * ensures, for example, that if the <code>SOAPHeaderElement</code>
+ * object modifies the message, that the message is being modified correctly.
+ *
+ * @param mustUnderstand <code>true</code> to set the mustUnderstand
+ * attribute to true; <code>false</code> to set it to false
+ *
+ * @exception IllegalArgumentException if there is a problem in
+ * setting the mustUnderstand attribute
+ * @see #getMustUnderstand
+ * @see #setRelay
+ */
+ public void setMustUnderstand(boolean mustUnderstand);
+
+ /**
+ * Returns the boolean value of the mustUnderstand attribute for this
+ * <code>SOAPHeaderElement</code>.
+ *
+ * @return <code>true</code> if the mustUnderstand attribute of this
+ * <code>SOAPHeaderElement</code> object is turned on; <code>false</code>
+ * otherwise
+ */
+ public boolean getMustUnderstand();
+
+ /**
+ * Sets the <i>relay</i> attribute for this <code>SOAPHeaderElement</code> to be
+ * either true or false.
+ * <P>
+ * The SOAP relay attribute is set to true to indicate that the SOAP header
+ * block must be relayed by any node that is targeted by the header block
+ * but not actually process it. This attribute is ignored on header blocks
+ * whose mustUnderstand attribute is set to true or that are targeted at
+ * the ultimate reciever (which is the default). The default value of this
+ * attribute is <code>false</code>.
+ *
+ * @param relay the new value of the <i>relay</i> attribute
+ *
+ * @exception SOAPException if there is a problem in setting the
+ * relay attribute.
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Relay attribute.
+ *
+ * @see #setMustUnderstand
+ * @see #getRelay
+ *
+ * @since SAAJ 1.3
+ */
+ public void setRelay(boolean relay) throws SOAPException;
+
+ /**
+ * Returns the boolean value of the <i>relay</i> attribute for this
+ * <code>SOAPHeaderElement</code>
+ *
+ * @return <code>true</code> if the relay attribute is turned on;
+ * <code>false</code> otherwise
+ *
+ * @exception UnsupportedOperationException if this message does not
+ * support the SOAP 1.2 concept of Relay attribute.
+ *
+ * @see #getMustUnderstand
+ * @see #setRelay
+ *
+ * @since SAAJ 1.3
+ */
+ public boolean getRelay();
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPMessage.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPMessage.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPMessage.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,458 @@
+/*
+ * $Id: SOAPMessage.java,v 1.23 2006/03/30 00:59:42 ofung Exp $
+ * $Revision: 1.23 $
+ * $Date: 2006/03/30 00:59:42 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+import java.io.OutputStream;
+import java.io.IOException;
+
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+
+/**
+ * The root class for all SOAP messages. As transmitted on the "wire", a SOAP
+ * message is an XML document or a MIME message whose first body part is an
+ * XML/SOAP document.
+ * <P>
+ * A <code>SOAPMessage</code> object consists of a SOAP part and optionally
+ * one or more attachment parts. The SOAP part for a <code>SOAPMessage</code>
+ * object is a <code>SOAPPart</code> object, which contains information used
+ * for message routing and identification, and which can contain
+ * application-specific content. All data in the SOAP Part of a message must be
+ * in XML format.
+ * <P>
+ * A new <code>SOAPMessage</code> object contains the following by default:
+ * <UL>
+ * <LI>A <code>SOAPPart</code> object
+ * <LI>A <code>SOAPEnvelope</code> object
+ * <LI>A <code>SOAPBody</code> object
+ * <LI>A <code>SOAPHeader</code> object
+ * </UL>
+ * The SOAP part of a message can be retrieved by calling the method <code>SOAPMessage.getSOAPPart()</code>.
+ * The <code>SOAPEnvelope</code> object is retrieved from the <code>SOAPPart</code>
+ * object, and the <code>SOAPEnvelope</code> object is used to retrieve the
+ * <code>SOAPBody</code> and <code>SOAPHeader</code> objects.
+ *
+ * <PRE>
+ * SOAPPart sp = message.getSOAPPart();
+ * SOAPEnvelope se = sp.getEnvelope();
+ * SOAPBody sb = se.getBody();
+ * SOAPHeader sh = se.getHeader();
+ * </PRE>
+ *
+ * <P>
+ * In addition to the mandatory <code>SOAPPart</code> object, a <code>SOAPMessage</code>
+ * object may contain zero or more <code>AttachmentPart</code> objects, each
+ * of which contains application-specific data. The <code>SOAPMessage</code>
+ * interface provides methods for creating <code>AttachmentPart</code>
+ * objects and also for adding them to a <code>SOAPMessage</code> object. A
+ * party that has received a <code>SOAPMessage</code> object can examine its
+ * contents by retrieving individual attachment parts.
+ * <P>
+ * Unlike the rest of a SOAP message, an attachment is not required to be in
+ * XML format and can therefore be anything from simple text to an image file.
+ * Consequently, any message content that is not in XML format must be in an
+ * <code>AttachmentPart</code> object.
+ * <P>
+ * A <code>MessageFactory</code> object may create <code>SOAPMessage</code>
+ * objects with behavior that is specialized to a particular implementation or
+ * application of SAAJ. For instance, a <code>MessageFactory</code> object
+ * may produce <code>SOAPMessage</code> objects that conform to a particular
+ * Profile such as ebXML. In this case a <code>MessageFactory</code> object
+ * might produce <code>SOAPMessage</code> objects that are initialized with
+ * ebXML headers.
+ * <P>
+ * In order to ensure backward source compatibility, methods that are added to
+ * this class after version 1.1 of the SAAJ specification are all concrete
+ * instead of abstract and they all have default implementations. Unless
+ * otherwise noted in the JavaDocs for those methods the default
+ * implementations simply throw an <code>UnsupportedOperationException</code>
+ * and the SAAJ implementation code must override them with methods that
+ * provide the specified behavior. Legacy client code does not have this
+ * restriction, however, so long as there is no claim made that it conforms to
+ * some later version of the specification than it was originally written for.
+ * A legacy class that extends the SOAPMessage class can be compiled and/or run
+ * against succeeding versions of the SAAJ API without modification. If such a
+ * class was correctly implemented then it will continue to behave correctly
+ * relative to the version of the specification against which it was written.
+ *
+ * @see MessageFactory
+ * @see AttachmentPart
+ */
+public abstract class SOAPMessage {
+ /**
+ * Specifies the character type encoding for the SOAP Message. Valid values
+ * include "utf-8" and "utf-16". See vendor documentation for additional
+ * supported values. The default is "utf-8".
+ *
+ * @see SOAPMessage#setProperty(String, Object) SOAPMessage.setProperty
+ * @since SAAJ 1.2
+ */
+ public static final String CHARACTER_SET_ENCODING =
+ "javax.xml.soap.character-set-encoding";
+
+ /**
+ * Specifies whether the SOAP Message will contain an XML declaration when
+ * it is sent. The only valid values are "true" and "false". The default is
+ * "false".
+ *
+ * @see SOAPMessage#setProperty(String, Object) SOAPMessage.setProperty
+ * @since SAAJ 1.2
+ */
+ public static final String WRITE_XML_DECLARATION =
+ "javax.xml.soap.write-xml-declaration";
+
+ /**
+ * Sets the description of this <code>SOAPMessage</code> object's
+ * content with the given description.
+ *
+ * @param description a <code>String</code> describing the content of this
+ * message
+ * @see #getContentDescription
+ */
+ public abstract void setContentDescription(String description);
+
+ /**
+ * Retrieves a description of this <code>SOAPMessage</code> object's
+ * content.
+ *
+ * @return a <code>String</code> describing the content of this
+ * message or <code>null</code> if no description has been set
+ * @see #setContentDescription
+ */
+ public abstract String getContentDescription();
+
+ /**
+ * Gets the SOAP part of this <code>SOAPMessage</code> object.
+ * <P>
+ * <code>SOAPMessage</code> object contains one or more attachments, the
+ * SOAP Part must be the first MIME body part in the message.
+ *
+ * @return the <code>SOAPPart</code> object for this <code>SOAPMessage</code>
+ * object
+ */
+ public abstract SOAPPart getSOAPPart();
+
+ /**
+ * Gets the SOAP Body contained in this <code>SOAPMessage</code> object.
+ * <p>
+ *
+ * @return the <code>SOAPBody</code> object contained by this <code>SOAPMessage</code>
+ * object
+ * @exception SOAPException
+ * if the SOAP Body does not exist or cannot be retrieved
+ * @since SAAJ 1.2
+ */
+ public SOAPBody getSOAPBody() throws SOAPException {
+ throw new UnsupportedOperationException("getSOAPBody must be overridden by all subclasses of SOAPMessage");
+ }
+
+ /**
+ * Gets the SOAP Header contained in this <code>SOAPMessage</code>
+ * object.
+ * <p>
+ *
+ * @return the <code>SOAPHeader</code> object contained by this <code>SOAPMessage</code>
+ * object
+ * @exception SOAPException
+ * if the SOAP Header does not exist or cannot be retrieved
+ * @since SAAJ 1.2
+ */
+ public SOAPHeader getSOAPHeader() throws SOAPException {
+ throw new UnsupportedOperationException("getSOAPHeader must be overridden by all subclasses of SOAPMessage");
+ }
+
+ /**
+ * Removes all <code>AttachmentPart</code> objects that have been added
+ * to this <code>SOAPMessage</code> object.
+ * <P>
+ * This method does not touch the SOAP part.
+ */
+ public abstract void removeAllAttachments();
+
+ /**
+ * Gets a count of the number of attachments in this message. This count
+ * does not include the SOAP part.
+ *
+ * @return the number of <code>AttachmentPart</code> objects that are
+ * part of this <code>SOAPMessage</code> object
+ */
+ public abstract int countAttachments();
+
+ /**
+ * Retrieves all the <code>AttachmentPart</code> objects that are part of
+ * this <code>SOAPMessage</code> object.
+ *
+ * @return an iterator over all the attachments in this message
+ */
+ public abstract Iterator getAttachments();
+
+ /**
+ * Retrieves all the <code>AttachmentPart</code> objects that have header
+ * entries that match the specified headers. Note that a returned
+ * attachment could have headers in addition to those specified.
+ *
+ * @param headers
+ * a <code>MimeHeaders</code> object containing the MIME
+ * headers for which to search
+ * @return an iterator over all attachments that have a header that matches
+ * one of the given headers
+ */
+ public abstract Iterator getAttachments(MimeHeaders headers);
+
+ /**
+ * Removes all the <code>AttachmentPart</code> objects that have header
+ * entries that match the specified headers. Note that the removed
+ * attachment could have headers in addition to those specified.
+ *
+ * @param headers
+ * a <code>MimeHeaders</code> object containing the MIME
+ * headers for which to search
+ * @since SAAJ 1.3
+ */
+ public abstract void removeAttachments(MimeHeaders headers);
+
+
+ /**
+ * Returns an <code>AttachmentPart</code> object that is associated with an
+ * attachment that is referenced by this <code>SOAPElement</code> or
+ * <code>null</code> if no such attachment exists. References can be made
+ * via an <code>href</code> attribute as described in
+ * {@link <a href="http://www.w3.org/TR/SOAP-attachments#SOAPReferenceToAttachements">SOAP Messages with Attachments</a>},
+ * or via a single <code>Text</code> child node containing a URI as
+ * described in the WS-I Attachments Profile 1.0 for elements of schema
+ * type <i>ref:swaRef</i>({@link <a href=http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html">ref:swaRef</a>}). These two mechanisms must be supported.
+ * The support for references via <code>href</code> attribute also implies that
+ * this method should also be supported on an element that is an
+ * <i>xop:Include</i> element (
+ * {@link <a href="http://www.w3.org/2000/xp/Group/3/06/Attachments/XOP.html">XOP</a>}).
+ * other reference mechanisms may be supported by individual
+ * implementations of this standard. Contact your vendor for details.
+ *
+ * @param element The <code>SOAPElement</code> containing the reference to an Attachment
+ * @return the referenced <code>AttachmentPart</code> or null if no such
+ * <code>AttachmentPart</code> exists or no reference can be
+ * found in this <code>SOAPElement</code>.
+ * @throws SOAPException if there is an error in the attempt to access the
+ * attachment
+ *
+ * @since SAAJ 1.3
+ */
+ public abstract AttachmentPart getAttachment(SOAPElement element) throws SOAPException;
+
+
+ /**
+ * Adds the given <code>AttachmentPart</code> object to this <code>SOAPMessage</code>
+ * object. An <code>AttachmentPart</code> object must be created before
+ * it can be added to a message.
+ *
+ * @param AttachmentPart
+ * an <code>AttachmentPart</code> object that is to become part
+ * of this <code>SOAPMessage</code> object
+ * @exception IllegalArgumentException
+ */
+ public abstract void addAttachmentPart(AttachmentPart AttachmentPart);
+
+ /**
+ * Creates a new empty <code>AttachmentPart</code> object. Note that the
+ * method <code>addAttachmentPart</code> must be called with this new
+ * <code>AttachmentPart</code> object as the parameter in order for it to
+ * become an attachment to this <code>SOAPMessage</code> object.
+ *
+ * @return a new <code>AttachmentPart</code> object that can be populated
+ * and added to this <code>SOAPMessage</code> object
+ */
+ public abstract AttachmentPart createAttachmentPart();
+
+ /**
+ * Creates an <code>AttachmentPart</code> object and populates it using
+ * the given <code>DataHandler</code> object.
+ *
+ * @param dataHandler
+ * the <code>javax.activation.DataHandler</code> object that
+ * will generate the content for this <code>SOAPMessage</code>
+ * object
+ * @return a new <code>AttachmentPart</code> object that contains data
+ * generated by the given <code>DataHandler</code> object
+ * @exception IllegalArgumentException
+ * if there was a problem with the specified <code>DataHandler</code>
+ * object
+ * @see javax.activation.DataHandler
+ * @see javax.activation.DataContentHandler
+ */
+ public AttachmentPart createAttachmentPart(DataHandler dataHandler) {
+ AttachmentPart attachment = createAttachmentPart();
+ attachment.setDataHandler(dataHandler);
+ return attachment;
+ }
+
+ /**
+ * Returns all the transport-specific MIME headers for this <code>SOAPMessage</code>
+ * object in a transport-independent fashion.
+ *
+ * @return a <code>MimeHeaders</code> object containing the <code>MimeHeader</code>
+ * objects
+ */
+ public abstract MimeHeaders getMimeHeaders();
+
+ /**
+ * Creates an <code>AttachmentPart</code> object and populates it with
+ * the specified data of the specified content type. The type of the
+ * <code>Object</code> should correspond to the value given for the
+ * <code>Content-Type</code>.
+ *
+ * @param content
+ * an <code>Object</code> containing the content for the
+ * <code>AttachmentPart</code> object to be created
+ * @param contentType
+ * a <code>String</code> object giving the type of content;
+ * examples are "text/xml", "text/plain", and "image/jpeg"
+ * @return a new <code>AttachmentPart</code> object that contains the
+ * given data
+ * @exception IllegalArgumentException
+ * may be thrown if the contentType does not match the type
+ * of the content object, or if there was no
+ * <code>DataContentHandler</code> object for the given
+ * content object
+ * @see javax.activation.DataHandler
+ * @see javax.activation.DataContentHandler
+ */
+ public AttachmentPart createAttachmentPart(
+ Object content,
+ String contentType) {
+ AttachmentPart attachment = createAttachmentPart();
+ attachment.setContent(content, contentType);
+ return attachment;
+ }
+
+ /**
+ * Updates this <code>SOAPMessage</code> object with all the changes that
+ * have been made to it. This method is called automatically when
+ * {@link SOAPMessage#writeTo(OutputStream)} is called. However, if
+ * changes are made to a message that was received or to one that has
+ * already been sent, the method <code>saveChanges</code> needs to be
+ * called explicitly in order to save the changes. The method <code>saveChanges</code>
+ * also generates any changes that can be read back (for example, a
+ * MessageId in profiles that support a message id). All MIME headers in a
+ * message that is created for sending purposes are guaranteed to have
+ * valid values only after <code>saveChanges</code> has been called.
+ * <P>
+ * In addition, this method marks the point at which the data from all
+ * constituent <code>AttachmentPart</code> objects are pulled into the
+ * message.
+ * <P>
+ *
+ * @exception <code>SOAPException</code> if there was a problem saving
+ * changes to this message.
+ */
+ public abstract void saveChanges() throws SOAPException;
+
+ /**
+ * Indicates whether this <code>SOAPMessage</code> object needs to have
+ * the method <code>saveChanges</code> called on it.
+ *
+ * @return <code>true</code> if <code>saveChanges</code> needs to be
+ * called; <code>false</code> otherwise.
+ */
+ public abstract boolean saveRequired();
+
+ /**
+ * Writes this <code>SOAPMessage</code> object to the given output
+ * stream. The externalization format is as defined by the SOAP 1.1 with
+ * Attachments specification.
+ * <P>
+ * If there are no attachments, just an XML stream is written out. For
+ * those messages that have attachments, <code>writeTo</code> writes a
+ * MIME-encoded byte stream.
+ * <P>
+ * Note that this method does not write the transport-specific MIME Headers
+ * of the Message
+ *
+ * @param out
+ * the <code>OutputStream</code> object to which this <code>SOAPMessage</code>
+ * object will be written
+ * @exception IOException
+ * if an I/O error occurs
+ * @exception SOAPException
+ * if there was a problem in externalizing this SOAP message
+ */
+ public abstract void writeTo(OutputStream out)
+ throws SOAPException, IOException;
+
+ /**
+ * Associates the specified value with the specified property. If there was
+ * already a value associated with this property, the old value is
+ * replaced.
+ * <p>
+ * The valid property names include
+ * {@link SOAPMessage#WRITE_XML_DECLARATION} and
+ * {@link SOAPMessage#CHARACTER_SET_ENCODING}. All of these standard SAAJ
+ * properties are prefixed by "javax.xml.soap". Vendors may also add
+ * implementation specific properties. These properties must be prefixed
+ * with package names that are unique to the vendor.
+ * <p>
+ * Setting the property <code>WRITE_XML_DECLARATION</code> to <code>"true"</code>
+ * will cause an XML Declaration to be written out at the start of the SOAP
+ * message. The default value of "false" suppresses this declaration.
+ * <p>
+ * The property <code>CHARACTER_SET_ENCODING</code> defaults to the value
+ * <code>"utf-8"</code> which causes the SOAP message to be encoded using
+ * UTF-8. Setting <code>CHARACTER_SET_ENCODING</code> to <code>"utf-16"</code>
+ * causes the SOAP message to be encoded using UTF-16.
+ * <p>
+ * Some implementations may allow encodings in addition to UTF-8 and
+ * UTF-16. Refer to your vendor's documentation for details.
+ *
+ * @param property
+ * the property with which the specified value is to be
+ * associated.
+ * @param value
+ * the value to be associated with the specified property
+ * @exception SOAPException
+ * if the property name is not recognized.
+ * @since SAAJ 1.2
+ */
+ public void setProperty(String property, Object value)
+ throws SOAPException {
+ throw new UnsupportedOperationException("setProperty must be overridden by all subclasses of SOAPMessage");
+ }
+
+ /**
+ * Retrieves value of the specified property.
+ *
+ * @param property
+ * the name of the property to retrieve
+ * @return the value associated with the named property or <code>null</code>
+ * if no such property exists.
+ * @exception SOAPException
+ * if the property name is not recognized.
+ * @since SAAJ 1.2
+ */
+ public Object getProperty(String property) throws SOAPException {
+ throw new UnsupportedOperationException("getProperty must be overridden by all subclasses of SOAPMessage");
+ }
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPPart.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPPart.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/SOAPPart.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,267 @@
+/*
+ * $Id: SOAPPart.java,v 1.10 2006/03/30 00:59:42 ofung Exp $
+ * $Revision: 1.10 $
+ * $Date: 2006/03/30 00:59:42 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+import java.util.Iterator;
+
+import javax.xml.transform.Source;
+
+/**
+ * The container for the SOAP-specific portion of a <code>SOAPMessage</code>
+ * object. All messages are required to have a SOAP part, so when a
+ * <code>SOAPMessage</code> object is created, it will automatically
+ * have a <code>SOAPPart</code> object.
+ *<P>
+ * A <code>SOAPPart</code> object is a MIME part and has the MIME headers
+ * Content-Id, Content-Location, and Content-Type. Because the value of
+ * Content-Type must be "text/xml", a <code>SOAPPart</code> object automatically
+ * has a MIME header of Content-Type with its value set to "text/xml".
+ * The value must be "text/xml" because content in the SOAP part of a
+ * message must be in XML format. Content that is not of type "text/xml"
+ * must be in an <code>AttachmentPart</code> object rather than in the
+ * <code>SOAPPart</code> object.
+ * <P>
+ * When a message is sent, its SOAP part must have the MIME header Content-Type
+ * set to "text/xml". Or, from the other perspective, the SOAP part of any
+ * message that is received must have the MIME header Content-Type with a
+ * value of "text/xml".
+ * <P>
+ * A client can access the <code>SOAPPart</code> object of a
+ * <code>SOAPMessage</code> object by
+ * calling the method <code>SOAPMessage.getSOAPPart</code>. The
+ * following line of code, in which <code>message</code> is a
+ * <code>SOAPMessage</code> object, retrieves the SOAP part of a message.
+ * <PRE>
+ * SOAPPart soapPart = message.getSOAPPart();
+ * </PRE>
+ * <P>
+ * A <code>SOAPPart</code> object contains a <code>SOAPEnvelope</code> object,
+ * which in turn contains a <code>SOAPBody</code> object and a
+ * <code>SOAPHeader</code> object.
+ * The <code>SOAPPart</code> method <code>getEnvelope</code> can be used
+ * to retrieve the <code>SOAPEnvelope</code> object.
+ * <P>
+ */
+public abstract class SOAPPart implements org.w3c.dom.Document, Node {
+
+ /**
+ * Gets the <code>SOAPEnvelope</code> object associated with this
+ * <code>SOAPPart</code> object. Once the SOAP envelope is obtained, it
+ * can be used to get its contents.
+ *
+ * @return the <code>SOAPEnvelope</code> object for this
+ * <code>SOAPPart</code> object
+ * @exception SOAPException if there is a SOAP error
+ */
+ public abstract SOAPEnvelope getEnvelope() throws SOAPException;
+
+ /**
+ * Retrieves the value of the MIME header whose name is "Content-Id".
+ *
+ * @return a <code>String</code> giving the value of the MIME header
+ * named "Content-Id"
+ * @see #setContentId
+ */
+ public String getContentId() {
+ String[] values = getMimeHeader("Content-Id");
+ if (values != null && values.length > 0)
+ return values[0];
+ return null;
+ }
+
+ /**
+ * Retrieves the value of the MIME header whose name is "Content-Location".
+ *
+ * @return a <code>String</code> giving the value of the MIME header whose
+ * name is "Content-Location"
+ * @see #setContentLocation
+ */
+ public String getContentLocation() {
+ String[] values = getMimeHeader("Content-Location");
+ if (values != null && values.length > 0)
+ return values[0];
+ return null;
+ }
+
+ /**
+ * Sets the value of the MIME header named "Content-Id"
+ * to the given <code>String</code>.
+ *
+ * @param contentId a <code>String</code> giving the value of the MIME
+ * header "Content-Id"
+ *
+ * @exception IllegalArgumentException if there is a problem in
+ * setting the content id
+ * @see #getContentId
+ */
+ public void setContentId(String contentId)
+ {
+ setMimeHeader("Content-Id", contentId);
+ }
+ /**
+ * Sets the value of the MIME header "Content-Location"
+ * to the given <code>String</code>.
+ *
+ * @param contentLocation a <code>String</code> giving the value
+ * of the MIME
+ * header "Content-Location"
+ * @exception IllegalArgumentException if there is a problem in
+ * setting the content location.
+ * @see #getContentLocation
+ */
+ public void setContentLocation(String contentLocation)
+ {
+ setMimeHeader("Content-Location", contentLocation);
+ }
+ /**
+ * Removes all MIME headers that match the given name.
+ *
+ * @param header a <code>String</code> giving the name of the MIME header(s) to
+ * be removed
+ */
+ public abstract void removeMimeHeader(String header);
+
+ /**
+ * Removes all the <code>MimeHeader</code> objects for this
+ * <code>SOAPEnvelope</code> object.
+ */
+ public abstract void removeAllMimeHeaders();
+
+ /**
+ * Gets all the values of the <code>MimeHeader</code> object
+ * in this <code>SOAPPart</code> object that
+ * is identified by the given <code>String</code>.
+ *
+ * @param name the name of the header; example: "Content-Type"
+ * @return a <code>String</code> array giving all the values for the
+ * specified header
+ * @see #setMimeHeader
+ */
+ public abstract String[] getMimeHeader(String name);
+
+ /**
+ * Changes the first header entry that matches the given header name
+ * so that its value is the given value, adding a new header with the
+ * given name and value if no
+ * existing header is a match. If there is a match, this method clears
+ * all existing values for the first header that matches and sets the
+ * given value instead. If more than one header has
+ * the given name, this method removes all of the matching headers after
+ * the first one.
+ * <P>
+ * Note that RFC822 headers can contain only US-ASCII characters.
+ *
+ * @param name a <code>String</code> giving the header name
+ * for which to search
+ * @param value a <code>String</code> giving the value to be set.
+ * This value will be substituted for the current value(s)
+ * of the first header that is a match if there is one.
+ * If there is no match, this value will be the value for
+ * a new <code>MimeHeader</code> object.
+ *
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified mime header name or value
+ * @see #getMimeHeader
+ */
+ public abstract void setMimeHeader(String name, String value);
+
+ /**
+ * Creates a <code>MimeHeader</code> object with the specified
+ * name and value and adds it to this <code>SOAPPart</code> object.
+ * If a <code>MimeHeader</code> with the specified name already
+ * exists, this method adds the specified value to the already
+ * existing value(s).
+ * <P>
+ * Note that RFC822 headers can contain only US-ASCII characters.
+ *
+ * @param name a <code>String</code> giving the header name
+ * @param value a <code>String</code> giving the value to be set
+ * or added
+ * @exception IllegalArgumentException if there was a problem with
+ * the specified mime header name or value
+ */
+ public abstract void addMimeHeader(String name, String value);
+
+ /**
+ * Retrieves all the headers for this <code>SOAPPart</code> object
+ * as an iterator over the <code>MimeHeader</code> objects.
+ *
+ * @return an <code>Iterator</code> object with all of the Mime
+ * headers for this <code>SOAPPart</code> object
+ */
+ public abstract Iterator getAllMimeHeaders();
+
+ /**
+ * Retrieves all <code>MimeHeader</code> objects that match a name in
+ * the given array.
+ *
+ * @param names a <code>String</code> array with the name(s) of the
+ * MIME headers to be returned
+ * @return all of the MIME headers that match one of the names in the
+ * given array, returned as an <code>Iterator</code> object
+ */
+ public abstract Iterator getMatchingMimeHeaders(String[] names);
+
+ /**
+ * Retrieves all <code>MimeHeader</code> objects whose name does
+ * not match a name in the given array.
+ *
+ * @param names a <code>String</code> array with the name(s) of the
+ * MIME headers not to be returned
+ * @return all of the MIME headers in this <code>SOAPPart</code> object
+ * except those that match one of the names in the
+ * given array. The nonmatching MIME headers are returned as an
+ * <code>Iterator</code> object.
+ */
+ public abstract Iterator getNonMatchingMimeHeaders(String[] names);
+
+ /**
+ * Sets the content of the <code>SOAPEnvelope</code> object with the data
+ * from the given <code>Source</code> object. This <code>Source</code>
+ * must contain a valid SOAP document.
+ *
+ * @param source the <code>javax.xml.transform.Source</code> object with the
+ * data to be set
+ *
+ * @exception SOAPException if there is a problem in setting the source
+ * @see #getContent
+ */
+ public abstract void setContent(Source source) throws SOAPException;
+
+ /**
+ * Returns the content of the SOAPEnvelope as a JAXP <code>Source</code>
+ * object.
+ *
+ * @return the content as a <code>javax.xml.transform.Source</code> object
+ *
+ * @exception SOAPException if the implementation cannot convert
+ * the specified <code>Source</code> object
+ * @see #setContent
+ */
+ public abstract Source getContent() throws SOAPException;
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Text.java
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Text.java (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/Text.java 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,44 @@
+/*
+ * $Id: Text.java,v 1.4 2006/03/30 00:59:42 ofung Exp $
+ * $Revision: 1.4 $
+ * $Date: 2006/03/30 00:59:42 $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the license at
+ * https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of a node whose value is text. A <code>Text</code> object
+ * may represent text that is content or text that is a comment.
+ *
+ */
+public interface Text extends Node, org.w3c.dom.Text {
+
+ /**
+ * Retrieves whether this <code>Text</code> object represents a comment.
+ *
+ * @return <code>true</code> if this <code>Text</code> object is a
+ * comment; <code>false</code> otherwise
+ */
+ public boolean isComment();
+}
Added: projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/package.html
===================================================================
--- projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/package.html (rev 0)
+++ projects/specs/trunk/jboss-saaj-api_1.3_spec/src/main/java/javax/xml/soap/package.html 2010-05-18 01:16:44 UTC (rev 104892)
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+ <!--
+
+ @(#)package.html 1.60 98/01/27
+
+ Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,
+ Palo Alto, California, 94303, U.S.A. All Rights Reserved.
+
+ This software is the confidential and proprietary information of Sun
+ Microsystems, Inc. ("Confidential Information"). You shall not
+ disclose such Confidential Information and shall use it only in
+ accordance with the terms of the license agreement you entered into
+ with Sun.
+
+ CopyrightVersion 1.2
+
+-->
+ <title></title>
+
+</head>
+ <body bgcolor="white">
+ Provides the API for creating and building SOAP messages. This package
+ is defined in the <i>SOAP with Attachments API for Java<sup><font
+ size="-2">TM</font></sup> (SAAJ) 1.3</i> specification.
+<p> The API in the <code>javax.xml.soap</code> package allows you to do the
+ following: </p>
+
+<ul>
+ <li>create a point-to-point connection to a specified endpoint </li>
+ <li>create a SOAP message </li>
+ <li>create an XML fragment </li>
+ <li>add content to the header of a SOAP message </li>
+ <li>add content to the body of a SOAP message </li>
+ <li>create attachment parts and add content to them </li>
+ <li>access/add/modify parts of a SOAP message </li>
+ <li>create/add/modify SOAP fault information </li>
+ <li>extract content from a SOAP message </li>
+ <li>send a SOAP request-response message </li>
+
+</ul>
+
+<p> <!-- <h2>Package Specification</h2> --> <!-- The SAAJ 1.1 specification gives an overview of the -->
+ <!-- <code>javax.xml.soap</code> package and --> <!-- explains how its classes and interfaces work. -->
+ <!-- <ul> --> <!-- <li><a href="http://java.sun.com/xml/downloads/jaxm.html"> -->
+ <!-- SAAJ 1.1 Specification</a> --> <!-- </ul> --> <!-- <h2>Related Documentation</h2> -->
+ <!-- For overviews, tutorials, examples, guides, and tool documentation, please see: -->
+ <!-- <ul> --> <!-- <li><a href="../../../../tutorial/doc/JAXM.html">JAXM Tutorial</a> -->
+ <!-- <li><a href="../../../../jaxm/index.html">JAXM Reference Implementation (RI) -->
+ <!-- Documentation</a> --> <!-- </ul> --> </p>
+In addition the APIs in the <code>javax.xml.soap</code> package extend
+their counterparts in the <code>org.w3c.dom</code> package. This means that
+the <code>SOAPPart</code> of a <code>SOAPMessage</code> is also a DOM Level
+2 <code>Document</code>, and can be manipulated as such by applications,
+tools and libraries that use DOM (see http://www.w3.org/DOM/ for more information).
+It is important to note that, while it is possible to use DOM APIs to add
+ordinary DOM nodes to a SAAJ tree, the SAAJ APIs are still required to return
+SAAJ types when examining or manipulating the tree. In order to accomplish
+this the SAAJ APIs (specifically {@link javax.xml.soap.SOAPElement#getChildElements()})
+are allowed to silently replace objects that are incorrectly typed relative
+to SAAJ requirements with equivalent objects of the required type. These
+replacements must never cause the logical structure of the tree to change,
+so from the perspective of the DOM APIs the tree will remain unchanged. However,
+the physical composition of the tree will have changed so that references
+to the nodes that were replaced will refer to nodes that are no longer a
+part of the tree. The SAAJ APIs are not allowed to make these replacements
+if they are not required so the replacement objects will never subsequently
+be silently replaced by future calls to the SAAJ API.
+<p>
+What this means in
+practical terms is that an application that starts to use SAAJ APIs on a
+tree after manipulating it using DOM APIs must assume that the tree has been
+translated into an all SAAJ tree and that any references to objects within
+the tree that were obtained using DOM APIs are no longer valid. Switching
+from SAAJ APIs to DOM APIs is not allowed to cause invalid references and
+neither is using SAAJ APIs exclusively. It is only switching from using DOM
+APIs on a particular SAAJ tree to using SAAJ APIs that causes the risk of
+invalid references.<br>
+
+</body>
+</html>
More information about the jboss-cvs-commits
mailing list