Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 29044 invoked by uid 500); 25 Jan 2002 16:30:09 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 29035 invoked by uid 500); 25 Jan 2002 16:30:09 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 25 Jan 2002 16:30:08 -0000 Message-ID: <20020125163008.87078.qmail@icarus.apache.org> From: dims@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/javax/xml/transform Source.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dims 02/01/25 08:30:08 Modified: java build.xml Added: java/src/javax/xml/messaging Endpoint.java URLEndpoint.java java/src/javax/xml/soap AttachmentPart.java Detail.java DetailEntry.java FactoryFinder.java MessageFactory.java MimeHeader.java MimeHeaders.java Name.java Node.java SOAPBody.java SOAPBodyElement.java SOAPConnection.java SOAPConnectionFactory.java SOAPConstants.java SOAPElement.java SOAPElementFactory.java SOAPEnvelope.java SOAPException.java SOAPFault.java SOAPFaultElement.java SOAPHeader.java SOAPHeaderElement.java SOAPMessage.java SOAPPart.java Text.java java/src/javax/xml/transform Source.java Log: First cut of javax.xml.soap package from JAXM Spec. - This is a subset of the classes from JAXM that we need for JAX-RPC 0.6 - Had to check in 2 classes in javax.xml.messaging that were referenced from javax.xml.soap package. - Had to check in 1 class in javax.xml.transform that was referenced from javax.xml.soap package. - Needs "attachments.present" to compile. Does not compile if attachments.present is false. - Javadocs were hand-copied from JAXM Spec's Javadocs (JAX Winter Pack) - As soon as we get an official copy we can replace this code with the "official" copy. Revision Changes Path 1.99 +2 -0 xml-axis/java/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-axis/java/build.xml,v retrieving revision 1.98 retrieving revision 1.99 diff -u -r1.98 -r1.99 --- build.xml 11 Jan 2002 18:44:06 -0000 1.98 +++ build.xml 25 Jan 2002 16:30:07 -0000 1.99 @@ -205,7 +205,9 @@ + + . */ package javax.xml.messaging; /** * An opaque representation of an application endpoint. Typically, an * Endpoint object represents a business entity, but it * may represent a party of any sort. Conceptually, an * Endpoint object is the mapping of a logical name * (example, a URI) to a physical location, such as a URL. *

* For messaging using a provider that supports profiles, an application * does not need to specify an endpoint when it sends a message because * destination information will be contained in the profile-specific header. * However, for point-to-point plain SOAP messaging, an application must supply * an Endpoint object to * the SOAPConnection method call * to indicate the intended destination for the message. * The subclass {@link URLEndpoint URLEndpoint} can be used when an application * wants to send a message directly to a remote party without using a * messaging provider. *

* The default identification for an Endpoint object * is a URI. This defines what JAXM messaging * providers need to support at minimum for identification of * destinations. A messaging provider * needs to be configured using a deployment-specific mechanism with * mappings from an endpoint to the physical details of that endpoint. *

* Endpoint objects can be created using the constructor, or * they can be looked up in a naming * service. The latter is more flexible because logical identifiers * or even other naming schemes (such as DUNS numbers) * can be bound and rebound to specific URIs. */ public class Endpoint { /** * Constructs an Endpoint object using the given string identifier. * @param uri a string that identifies the party that this Endpoint object represents; the default is a URI */ public Endpoint(String uri) { id = uri; } /** * Retrieves a string representation of this Endpoint object. This string is likely to be provider-specific, and * programmers are discouraged from parsing and programmatically interpreting the contents of this string. * @return a String with a provider-specific representation of this Endpoint object */ public String toString() { return id; } /** A string that identifies the party that this Endpoint object represents; a URI is the default. */ protected String id; } 1.1 xml-axis/java/src/javax/xml/messaging/URLEndpoint.java Index: URLEndpoint.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.messaging; /** * A special case of the Endpoint class used for simple applications that want to communicate directly * with another SOAP-based application in a point-to-point fashion instead of going through a messaging provider. *

* A URLEndpoint object contains a URL, which is used to make connections to the remote party. * A standalone client can pass a URLEndpoint object to the SOAPConnection method call to * send a message synchronously. */ public class URLEndpoint extends Endpoint { /** * Constructs a new URLEndpoint object using the given URL. * @param url a String giving the URL to use in constructing the new URLEndpoint object */ public URLEndpoint(String url) { super(url); } /** * Gets the URL associated with this URLEndpoint object. * @return a String giving the URL associated with this URLEndpoint object */ public String getURL() { return super.id; } } 1.1 xml-axis/java/src/javax/xml/soap/AttachmentPart.java Index: AttachmentPart.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import javax.activation.DataHandler; import java.util.Iterator; /** *

A single attachment to a SOAPMessage object. A * SOAPMessage object may contain zero, one, or many * AttachmentPart objects. Each * AttachmentPart 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.

* *

An AttachmentPart object must conform to * certain standards.

* *
    *
  1. It must conform to MIME [RFC2045] * standards
  2. * *
  3. It MUST contain content
  4. * *
  5. * The header portion MUST include the following header: * *
      *
    • * Content-Type
      * This header identifies the type of data in the content * of an AttachmentPart object and MUST * conform to [RFC2045]. The following is an example of a * Content-Type header: *
         *      Content-Type:  application/xml
         *
         * 
      * The following line of code, in which ap is * an AttachmentPart object, sets the header * shown in the previous example. *
         *      ap.setMimeHeader("Content-Type", "application/xml");
         *
         * 
      * *

      *
    • *
    *
  6. *
* *

There are no restrictions on the content portion of an * AttachmentPart object. The content may be anything * from a simple plain text object to a complex XML document or * image file.

* *

An AttachmentPart object is created with the * method SOAPMessage.createAttachmentPart. After * setting its MIME headers, the AttachmentPart * object is added to the message that created it with the method * SOAPMessage.addAttachmentPart.

* *

The following code fragment, in which m is a * SOAPMessage object and contentStringl * is a String, creates an instance of * AttachmentPart, sets the AttachmentPart * object with some content and header information, and adds the * AttachmentPart object to the * SOAPMessage object.

*
   *    AttachmentPart ap1 = m.createAttachmentPart();
   *    ap1.setContent(contentString1, "text/plain");
   *    m.addAttachmentPart(ap1);
   * 
* *

The following code fragment creates and adds a second * AttachmentPart instance to the same message. * jpegData is a binary byte buffer representing the jpeg * file.

*
   *    AttachmentPart ap2 = m.createAttachmentPart();
   *    byte[] jpegData =  ...;
   *    ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg");
   *    m.addAttachmentPart(ap2);
   * 
* *

The getContent method retrieves the contents * and header from an AttachmentPart object. * Depending on the DataContentHandler objects * present, the returned Object can either be a typed * Java object corresponding to the MIME type or an * InputStream object that contains the content as * bytes.

*
   *    String content1 = ap1.getContent();
   *    java.io.InputStream content2 = ap2.getContent();
   * 
* The method clearContent removes all the content * from an AttachmentPart object but does not affect * its header information. *
   *    ap1.clearContent();
   * 
*/ public abstract class AttachmentPart { /** */ public AttachmentPart() {} /** * Returns the number of bytes in this * AttachmentPart object. * @return the size of this AttachmentPart object * in bytes or -1 if the size cannot be determined * @throws 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 * AttachmentPart object. The MIME header portion is left * untouched. */ public abstract void clearContent(); /** * Gets the content of this AttachmentPart object * as a Java object. The type of the returned Java object * depends on (1) the DataContentHandler object * that is used to interpret the bytes and (2) the * Content-Type given in the header. * *

For the MIME content types "text/plain", "text/html" and * "text/xml", the DataContentHandler object does * the conversions to and from the Java types corresponding to * the MIME types. For other MIME types,the * DataContentHandler object can return an * InputStream object that contains the content data as * raw bytes.

* *

A JAXM-compliant implementation must, as a minimum, * return a java.lang.String object corresponding * to any content stream with a Content-Type * value of text/plain and a * javax.xml.transform.StreamSource object * corresponding to a content stream with a * Content-Type value of text/xml. For * those content types that an installed * DataContentHandler object does not understand, the * DataContentHandler object is required to * return a java.io.InputStream object with the * raw bytes.

* @return a Java object with the content of this * AttachmentPart object * @throws SOAPException if there is no content set * into this AttachmentPart object or if there * was a data transformation error */ public abstract Object getContent() throws SOAPException; /** * Sets the content of this attachment part to that of the * given Object and sets the value of the * Content-Type header to the given type. The type of the * Object should correspond to the value given for * the Content-Type. This depends on the particular * set of DataContentHandler 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 * @throws java.lang.IllegalArgumentException if * the contentType does not match the type of the content * object, or if there was no * DataContentHandler object for this content * object * @see #getContent() getContent() */ public abstract void setContent(Object object, String contentType); /** * Gets the DataHandler object for this * AttachmentPart object. * @return the DataHandler object associated with * this AttachmentPart object * @throws SOAPException if there is * no data in this AttachmentPart object */ public abstract DataHandler getDataHandler() throws SOAPException; /** * Sets the given DataHandler object as the * data handler for this AttachmentPart object. * Typically, on an incoming message, the data handler is * automatically set. When a message is being created and * populated with content, the setDataHandler * method can be used to get data from various data sources into * the message. * @param datahandler DataHandler object to * be set * @throws java.lang.IllegalArgumentException if * there was a problem with the specified * DataHandler object */ public abstract void setDataHandler(DataHandler datahandler); /** * Gets the value of the MIME header whose name is * "Content-Id". * @return a String giving the value of the * "Content-Id" header or null if there is * none * @see #setContentId(java.lang.String) setContentId(java.lang.String) */ public String getContentId() { String as[] = getMimeHeader("Content-Id"); if (as != null) { return as[0]; } else { return null; } } /** * Gets the value of the MIME header * "Content-Location". * @return a String giving the value of the * "Content-Location" header or null if there * is none */ public String getContentLocation() { String as[] = getMimeHeader("Content-Location"); if (as != null) { return as[0]; } else { return null; } } /** * Gets the value of the MIME header "Content-Type". * @return a String giving the value of the * "Content-Type" header or null if there is * none */ public String getContentType() { String as[] = getMimeHeader("Content-Type"); if (as != null) { return as[0]; } else { return null; } } /** * Sets the MIME header "Content-Id" with the given * value. * @param contentId a String giving * the value of the "Content-Id" header * @throws java.lang.IllegalArgumentException if * there was a problem with the specified * contentId value * @see #getContentId() getContentId() */ public void setContentId(String contentId) { setMimeHeader("Content-Id", contentId); } /** * Sets the MIME header "Content-Location" with the given * value. * @param contentLocation a String * giving the value of the "Content-Location" header * @throws java.lang.IllegalArgumentException if * there was a problem with the specified content * location */ public void setContentLocation(String contentLocation) { setMimeHeader("Content-Location", contentLocation); } /** * Sets the MIME header "Content-Type" with the given * value. * @param contentType a String * giving the value of the "Content-Type" header * @throws java.lang.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 * String. * @param name the name of the header; example: * "Content-Type" * @return a String array giving the value for the * specified header * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String) */ 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. * *

Note that RFC822 headers can only contain US-ASCII * characters.

* @param name a String giving the * name of the header for which to search * @param value a String giving the * value to be set for the header whose name matches the * given name * @throws java.lang.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 AttachmentPart object. * *

Note that RFC822 headers can contain only US-ASCII * characters.

* @param name a String giving the * name of the header to be added * @param value a String giving the * value of the header to be added * @throws java.lang.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 * AttachmentPart object as an iterator over the * MimeHeader objects. * @return an Iterator object with all of the Mime * headers for this AttachmentPart object */ public abstract Iterator getAllMimeHeaders(); /** * Retrieves all MimeHeader objects that match * a name in the given array. * @param names a String 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 Iterator * object */ public abstract Iterator getMatchingMimeHeaders(String names[]); /** * Retrieves all MimeHeader objects whose name * does not match a name in the given array. * @param names a String array with * the name(s) of the MIME headers not to be returned * @return all of the MIME headers in this * AttachmentPart object except those that match one * of the names in the given array. The nonmatching MIME * headers are returned as an Iterator * object. */ public abstract Iterator getNonMatchingMimeHeaders(String names[]); } 1.1 xml-axis/java/src/javax/xml/soap/Detail.java Index: Detail.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import java.util.Iterator; /** * A container for DetailEntry objects. DetailEntry * objects give detailed error information that is application-specific and * related to the SOAPBody object that contains it. *

* A Detail object, which is part of a SOAPFault * object, can be retrieved using the method SOAPFault.getDetail. * The Detail interface provides two methods. One creates a new * DetailEntry object and also automatically adds it to * the Detail object. The second method gets a list of the * DetailEntry objects contained in a Detail * object. *

* The following code fragment, in which sf is a SOAPFault * object, gets its Detail object (d), adds a new * DetailEntry object to d, and then gets a list of all the * DetailEntry objects in d. The code also creates a * Name object to pass to the method addDetailEntry. * The variable se, used to create the Name object, * is a SOAPEnvelope object. *

   *    Detail d = sf.getDetail();
   *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
   *                                "http://www.wombat.org/trader");
   *    d.addDetailEntry(name);
   *    Iterator it = d.getDetailEntries();
   * 
*/ public interface Detail extends SOAPFaultElement { /** * Creates a new DetailEntry object with the given * name and adds it to this Detail object. * @param name a Name object identifying the new DetailEntry object * @return DetailEntry. * @throws SOAPException thrown when there is a problem in adding a DetailEntry object to this Detail object. */ public abstract DetailEntry addDetailEntry(Name name) throws SOAPException; /** * Gets a list of the detail entries in this Detail object. * @return an Iterator object over the DetailEntry * objects in this Detail object */ public abstract Iterator getDetailEntries(); } 1.1 xml-axis/java/src/javax/xml/soap/DetailEntry.java Index: DetailEntry.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * The content for a Detail object, giving details for * a SOAPFault object. A DetailEntry object, * which carries information about errors related to the SOAPBody * object that contains it, is application-specific. *

*/ public interface DetailEntry extends SOAPElement {} 1.1 xml-axis/java/src/javax/xml/soap/FactoryFinder.java Index: FactoryFinder.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.Properties; /** * TODO: Put description here. *

* @author name TODO: put author's name here. */ class FactoryFinder { /** TODO: Put description here. */ FactoryFinder() {} /** * TODO: Put description here. *

* @param s String. * @param classloader ClassLoader. * @return Object. * @throws SOAPException TODO: Put exception class-name and description here. */ private static Object newInstance(String s, ClassLoader classloader) throws SOAPException { try { Class class1; if (classloader == null) { class1 = Class.forName(s); } else { class1 = classloader.loadClass(s); } return class1.newInstance(); } catch (ClassNotFoundException classnotfoundexception) { throw new SOAPException("Provider " + s + " not found", classnotfoundexception); } catch (Exception exception) { throw new SOAPException("Provider " + s + " could not be instantiated: " + exception, exception); } } /** * TODO: Put description here. *

* @param s String. * @param s1 String. * @return Object. * @throws SOAPException TODO: Put exception class-name and description here. */ static Object find(String s, String s1) throws SOAPException { ClassLoader classloader; try { classloader = Thread.currentThread().getContextClassLoader(); } catch (Exception exception) { throw new SOAPException(exception.toString(), exception); } try { String s2 = System.getProperty(s); if (s2 != null) { return newInstance(s2, classloader); } } catch (SecurityException securityexception) {} try { String s3 = System.getProperty("java.home"); String s5 = s3 + File.separator + "lib" + File.separator + "jaxm.properties"; File file = new File(s5); if (file.exists()) { Properties properties = new Properties(); properties.load(new FileInputStream(file)); String s7 = properties.getProperty(s); return newInstance(s7, classloader); } } catch (Exception exception1) {} String s4 = "META-INF/services/" + s; try { java.io.InputStream inputstream = null; if (classloader == null) { inputstream = ClassLoader.getSystemResourceAsStream(s4); } else { inputstream = classloader.getResourceAsStream(s4); } if (inputstream != null) { BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream, "UTF-8")); String s6 = bufferedreader.readLine(); bufferedreader.close(); if ((s6 != null) &&!"".equals(s6)) { return newInstance(s6, classloader); } } } catch (Exception exception2) {} if (s1 == null) { throw new SOAPException("Provider for " + s + " cannot be found", null); } else { return newInstance(s1, classloader); } } } 1.1 xml-axis/java/src/javax/xml/soap/MessageFactory.java Index: MessageFactory.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import java.io.IOException; import java.io.InputStream; /** *

A factory for creating SOAPMessage objects.

* *

A JAXM client performs the following steps to create a * message.

* *
    *
  • * Creates a MessageFactory object from a * ProviderConnection object (con in the * following line of code). The String passed to * the createMessageFactory method is the name of * of a messaging profile, which must be the URL for the * schema. *
       *      MessageFactory mf = con.createMessageFactory(schemaURL);
       * 
    *
  • * *
  • * Calls the method createMessage on the * MessageFactory object. All messages produced by this * MessageFactory object will have the header * information appropriate for the messaging profile that was * specified when the MessageFactory object was * created. *
       *      SOAPMessage m = mf.createMessage();
       * 
    *
  • *
* It is also possible to create a MessageFactory * object using the method newInstance, as shown in * the following line of code. *
   *      MessageFactory mf = MessageFactory.newInstance();
   * 
* A standalone client (a client that is not running in a * container) can use the newInstance method to * create a MessageFactory object. * *

All MessageFactory objects, regardless of how * they are created, will produce SOAPMessage objects * that have the following elements by default:

* *
    *
  • A SOAPPart object
  • * *
  • A SOAPEnvelope object
  • * *
  • A SOAPBody object
  • * *
  • A SOAPHeader object
  • *
* If a MessageFactory object was created using a * ProviderConnection object, which means that it was * initialized with a specified profile, it will produce messages * that also come prepopulated with additional entries in the * SOAPHeader object and the SOAPBody * object. The content of a new SOAPMessage object * depends on which of the two MessageFactory methods * is used to create it. * *
    *
  • createMessage() -- message has no * content
    * This is the method clients would normally use to create a * request message.
  • * *
  • createMessage(MimeHeaders, * java.io.InputStream) -- message has content from the * InputStream object and headers from the * MimeHeaders object
    * This method can be used internally by a service * implementation to create a message that is a response to a * request.
  • *
*/ public abstract class MessageFactory { /** */ public MessageFactory() {} /** * Creates a new MessageFactory object that is * an instance of the default implementation. * @return a new MessageFactory object * @throws SOAPException if there was an error in * creating the default implementation of the * MessageFactory */ public static MessageFactory newInstance() throws SOAPException { try { return (MessageFactory) FactoryFinder.find( "javax.xml.soap.MessageFactory", "com.sun.xml.messaging.soap.MessageFactoryImpl"); } catch (Exception exception) { throw new SOAPException( "Unable to create message factory for SOAP: " + exception.getMessage()); } } /** * Creates a new SOAPMessage object with the * default SOAPPart, SOAPEnvelope, * SOAPBody, and SOAPHeader objects. * Profile-specific message factories can choose to * prepopulate the SOAPMessage object with * profile-specific headers. * *

Content can be added to this message's * SOAPPart object, and the message can be sent "as is" * when a message containing only a SOAP part is sufficient. * Otherwise, the SOAPMessage object needs to * create one or more AttachmentPart objects and * add them to itself. Any content that is not in XML format * must be in an AttachmentPart object.

* @return a new SOAPMessage object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPMessage createMessage() throws SOAPException; /** * TODO: Internalizes the contents of the given * InputStream object into a new SOAPMessage * object and returns the SOAPMessage object. * @param mimeheaders the transport-specific headers * passed to the message in a transport-independent fashion * for creation of the message * @param inputstream the InputStream object * that contains the data for a message * @return a new SOAPMessage object containing the * data from the given InputStream object * @throws IOException if there is a * problem in reading data from the input stream * @throws SOAPException if the message is invalid */ public abstract SOAPMessage createMessage( MimeHeaders mimeheaders, InputStream inputstream) throws IOException, SOAPException; /** */ static Class clz = null; /** */ private static final String DEFAULT_MESSAGE_FACTORY = "com.sun.xml.messaging.soap.MessageFactoryImpl"; /** */ private static final String MESSAGE_FACTORY_PROPERTY = "javax.xml.soap.MessageFactory"; } 1.1 xml-axis/java/src/javax/xml/soap/MimeHeader.java Index: MimeHeader.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * An object that stores a MIME header name and its value. One * or more MimeHeader objects may be contained in a * MimeHeaders object. * @see MimeHeaders MimeHeaders */ public class MimeHeader { /** * Constructs a MimeHeader object initialized * with the given name and value. * @param name a String giving the * name of the header * @param value a String giving the * value of the header */ public MimeHeader(String name, String value) { this.name = name; this.value = value; } /** * Returns the name of this MimeHeader * object. * @return the name of the header as a String */ public String getName() { return name; } /** * Returns the value of this MimeHeader * object. * @return the value of the header as a String */ public String getValue() { return value; } /** */ private String name; /** */ private String value; } 1.1 xml-axis/java/src/javax/xml/soap/MimeHeaders.java Index: MimeHeaders.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import java.util.Iterator; import java.util.Vector; /** * A container for MimeHeader objects, which * represent the MIME headers present in a MIME part of a * message.

* *

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 AttachmentPart and other MIME dependent parts * of the JAXM API. * @see SOAPMessage#getAttachments() SOAPMessage.getAttachments() * @see AttachmentPart AttachmentPart */ public class MimeHeaders { /** */ class MatchingIterator implements Iterator { /** * * @return */ private Object nextMatch() { label0: while (iterator.hasNext()) { MimeHeader mimeheader = (MimeHeader) iterator.next(); if (names == null) { return match ? null : mimeheader; } for (int i = 0; i < names.length; i++) { if (!mimeheader.getName().equalsIgnoreCase(names[i])) { continue; } if (match) { return mimeheader; } continue label0; } if (!match) { return mimeheader; } } return null; } /** * * @return */ public boolean hasNext() { if (nextHeader == null) { nextHeader = nextMatch(); } return nextHeader != null; } /** * * @return */ public Object next() { if (nextHeader != null) { Object obj = nextHeader; nextHeader = null; return obj; } if (hasNext()) { return nextHeader; } else { return null; } } /** */ public void remove() { iterator.remove(); } /** */ private boolean match; /** */ private Iterator iterator; /** */ private String names[]; /** */ private Object nextHeader; /** * * @param as * @param flag */ MatchingIterator(String as[], boolean flag) { match = flag; names = as; iterator = headers.iterator(); } } /** * Constructs * a default MimeHeaders object initialized with * an empty Vector object. */ public MimeHeaders() { headers = new Vector(); } /** * Returns all of the values for the specified header as an * array of String objects. * @param name the name of the header for which * values will be returned * @return a String array with all of the values * for the specified header * @see #setHeader(java.lang.String, java.lang.String) setHeader(java.lang.String, java.lang.String) */ public String[] getHeader(String name) { Vector vector = new Vector(); for (int i = 0; i < headers.size(); i++) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(i); if (mimeheader.getName().equalsIgnoreCase(name) && (mimeheader.getValue() != null)) { vector.addElement(mimeheader.getValue()); } } if (vector.size() == 0) { return null; } else { String as[] = new String[vector.size()]; vector.copyInto(as); return as; } } /** * 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. * *

Note that RFC822 headers can contain only US-ASCII * characters.

* @param name a String with the * name of the header for which to search * @param value a String with the * value that will replace the current value of the * specified header */ public void setHeader(String name, String value) { boolean flag = false; if ((name == null) || name.equals("") || (value == null) || value.equals("")) { throw new IllegalArgumentException( "Illegal MimeHeader name or value"); } for (int i = 0; i < headers.size(); i++) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(i); if (mimeheader.getName().equalsIgnoreCase(name)) { if (!flag) { headers.setElementAt(new MimeHeader(mimeheader .getName(), value), i); flag = true; } else { headers.removeElementAt(i--); } } } if (!flag) { addHeader(name, value); } } /** * Adds a MimeHeader object with the specified * name and value to this MimeHeaders object's * list of headers. * *

Note that RFC822 headers can contain only US-ASCII * characters.

* @param name a String with the * name of the header to be added * @param value a String with the * value of the header to be added * @throws java.lang.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("") || (value == null) || value.equals("")) { throw new IllegalArgumentException( "Illegal MimeHeader name or value"); } int i = headers.size(); for (int j = i - 1; j >= 0; j--) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(j); if (mimeheader.getName().equalsIgnoreCase(name)) { headers.insertElementAt(new MimeHeader(name, value), j + 1); return; } } headers.addElement(new MimeHeader(name, value)); } /** * Remove all MimeHeader objects whose name * matches the the given name. * @param name a String with the * name of the header for which to search */ public void removeHeader(String name) { for (int i = 0; i < headers.size(); i++) { MimeHeader mimeheader = (MimeHeader) headers.elementAt(i); if (mimeheader.getName().equalsIgnoreCase(name)) { headers.removeElementAt(i--); } } } /** * Removes all the header entries from this * MimeHeaders object. */ public void removeAllHeaders() { headers.removeAllElements(); } /** * Returns all the headers in this MimeHeaders * object. * @return an Iterator object over this * MimeHeaders object's list of * MimeHeader objects */ public Iterator getAllHeaders() { return headers.iterator(); } /** * Returns all the MimeHeader objects whose * name matches a name in the given array of names. * @param names an array of String * objects with the names for which to search * @return an Iterator object over the * MimeHeader 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 MimeHeader objects whose * name does not match a name in the given array of names. * @param names an array of String * objects with the names for which to search * @return an Iterator object over the * MimeHeader objects whose name does not match one * of the names in the given list */ public Iterator getNonMatchingHeaders(String names[]) { return new MatchingIterator(names, false); } /** */ private Vector headers; } 1.1 xml-axis/java/src/javax/xml/soap/Name.java Index: Name.java =================================================================== /* * The Apache Software License, Version 1.1 * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ 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. *

* The following is an example of a namespace declaration in an element. *

   *  <wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">
   * 
* ("xmlns" stands for "XML namespace".) * The following * shows what the methods in the Name interface will return. *
    *
  • getQualifiedName will return "prefix:LocalName" = * "WOMBAT:GetLastTradePrice" *
  • getURI will return "http://www.wombat.org/trader" *
  • getLocalName will return "GetLastTracePrice" *
  • getPrefix will return "WOMBAT" *
*

* XML namespaces are used to disambiguate SOAP identifiers from * application-specific identifiers. *

* Name objects are created using the method * SOAPEnvelope.createName, which has two versions. * One method creates Name objects with * a local name, a namespace prefix, and a namespace URI. * and the second creates Name objects with just a local name. * The following line of * code, in which se is a SOAPEnvelope object, creates a new * Name object with all three. *

   *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
   *                               "http://www.wombat.org/trader");
   * 
* The following line of code gives an example of how a Name object * can be used. The variable element is a SOAPElement object. * This code creates a new SOAPElement object with the given name and * adds it to element. *
   *    element.addChildElement(name);
   * 
*/ public interface Name { /** * Gets the local name part of the XML name that this Name * object represents. * @return a string giving the local name */ public abstract String getLocalName(); /** * Gets the namespace-qualified name of the XML name that this * Name object represents. * @return the namespace-qualified name as a string */ public abstract String getQualifiedName(); /** * Returns the prefix associated with the namespace for the XML * name that this Name object represents. * @return the prefix as a string */ public abstract String getPrefix(); /** * Returns the URI of the namespace for the XML * name that this Name object represents. * @return the URI as a string */ public abstract String getURI(); } 1.1 xml-axis/java/src/javax/xml/soap/Node.java Index: Node.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * A representation of a node (element) in a DOM representation of an XML document * that provides some tree manipulation methods. * This interface provides methods for getting the value of a node, for * getting and setting the parent of a node, and for removing a node. */ public interface Node { /** * Returns the the value of the immediate child of this Node * object if a child exists and its value is text. * @return a String with the text of the immediate child of * this Node object if (1) there is a child and * (2) the child is a Text object; * null otherwise */ public abstract String getValue(); /** * Sets the parent of this Node object to the given * SOAPElement object. * @param parent the SOAPElement object to be set as * the parent of this Node object * @throws SOAPException if there is a problem in setting the * parent to the given element * @see #getParentElement() getParentElement() */ public abstract void setParentElement(SOAPElement parent) throws SOAPException; /** * Returns the parent element of this Node object. * This method can throw an UnsupportedOperationException * if the tree is not kept in memory. * @return the SOAPElement object that is the parent of * this Node object or null if this * Node object is root * @see #setParentElement(javax.xml.soap.SOAPElement) setParentElement(javax.xml.soap.SOAPElement) */ public abstract SOAPElement getParentElement(); /** * Removes this Node object from the tree. Once * removed, this node can be garbage collected if there are no * application references to it. */ public abstract void detachNode(); /** * Notifies the implementation that this Node * 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. *

* Calling the method recycleNode implies that the method * detachNode has been called previously. */ public abstract void recycleNode(); } 1.1 xml-axis/java/src/javax/xml/soap/SOAPBody.java Index: SOAPBody.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * An object that represents the contents of the SOAP body * element in a SOAP message. A SOAP body element consists of XML data * that affects the way the application-specific content is processed. *

* A SOAPBody object contains SOAPBodyElement * objects, which have the content for the SOAP body. * A SOAPFault object, which carries status and/or * error information, is an example of a SOAPBodyElement object. * @see SOAPFault SOAPFault */ public interface SOAPBody extends SOAPElement { /** * Creates a new SOAPFault object and adds it to * this SOAPBody object. * @return the new SOAPFault object * @throws SOAPException if there is a SOAP error */ public abstract SOAPFault addFault() throws SOAPException; /** * Indicates whether a SOAPFault object exists in * this SOAPBody object. * @return true if a SOAPFault object exists in * this SOAPBody object; false * otherwise */ public abstract boolean hasFault(); /** * Returns the SOAPFault object in this SOAPBody * object. * @return the SOAPFault object in this SOAPBody * object */ public abstract SOAPFault getFault(); /** * Creates a new SOAPBodyElement object with the * specified name and adds it to this SOAPBody object. * @param name a Name object with the name for the new * SOAPBodyElement object * @return the new SOAPBodyElement object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPBodyElement addBodyElement(Name name) throws SOAPException; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPBodyElement.java Index: SOAPBodyElement.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * A SOAPBodyElement object represents the contents in * a SOAPBody object. The SOAPFault interface * is a SOAPBodyElement object that has been defined. *

* A new SOAPBodyElement object can be created and added * to a SOAPBody object with the SOAPBody * method addBodyElement. In the following line of code, * sb is a SOAPBody object, and * myName is a Name object. *

   *   SOAPBodyElement sbe = sb.addBodyElement(myName);
   * 
*/ public interface SOAPBodyElement extends SOAPElement {} 1.1 xml-axis/java/src/javax/xml/soap/SOAPConnection.java Index: SOAPConnection.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import javax.xml.messaging.Endpoint; /** *

A point-to-point connection that a client can use for * sending messages directly to a remote party (represented by a * URL, for instance) without using a messaging provider. A * standalone client uses a SOAPConnection object * rather than a ProviderConnection object.

* *

A client can obtain a SOAPConnection object * simply by calling the following static method.

*
   *     SOAPConnection con = SOAPConnection.newInstance();
   * 
* A SOAPConnection object can be used to send * messages directly to a URL following the request/response * paradigm. That is, messages are sent using the method * call, which sends the message and then waits until it * gets a reply. */ public abstract class SOAPConnection { /** */ public SOAPConnection() {} /** * Sends the given message to the specified endpoint and * blocks until it has returned the response. * @param request the SOAPMessage * object to be sent * @param endpoint a URLEndpoint * object giving the URL to which the message should be * sent * @return the SOAPMessage 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, Endpoint endpoint) throws SOAPException; /** * Closes this SOAPConnection object. * @throws SOAPException if there is a SOAP error */ public abstract void close() throws SOAPException; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPConnectionFactory.java Index: SOAPConnectionFactory.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** */ public abstract class SOAPConnectionFactory { /** */ public SOAPConnectionFactory() {} /** * Creates an instance of the default * SOAPConnectionFactory object. * @return a new instance of a default * SOAPConnectionFactory object * @throws SOAPException if there was an error creating * the SOAPConnectionFactory */ public static SOAPConnectionFactory newInstance() throws SOAPException { try { return (SOAPConnectionFactory) FactoryFinder.find( "javax.xml.soap.SOAPConnectionFactory", "com.sun.xml.messaging.client.p2p.HttpSOAPConnectionFactory"); } catch (Exception exception) { throw new SOAPException("Unable to create SOAP connection factory: " + exception.getMessage()); } } /** * Create a new SOAPConnection. * @return the new SOAPConnection object. * @throws SOAPException if there was an exception * creating the SOAPConnection object. */ public abstract SOAPConnection createConnection() throws SOAPException; /** */ private static final String DEFAULT_SOAP_CONNECTION_FACTORY = "com.sun.xml.messaging.client.p2p.HttpSOAPConnectionFactory"; /** */ private static final String SF_PROPERTY = "javax.xml.soap.SOAPConnectionFactory"; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPConstants.java Index: SOAPConstants.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** The definition of constants pertaining to the SOAP 1.1 protocol. */ public interface SOAPConstants { /** The namespace identifier for the SOAP envelope. */ public static final String URI_NS_SOAP_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/"; /** * The namespace identifier for the SOAP encoding (see section 5 of * the SOAP 1.1 specification). */ public static final String URI_NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; /** * The URI identifying the first application processing a SOAP request as the intended * actor for a SOAP header entry (see section 4.2.2 of the SOAP 1.1 specification). */ public static final String URI_SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next"; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPElement.java Index: SOAPElement.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import java.util.Iterator; /** * An object representing the contents in a * SOAPBody object, the contents in a SOAPHeader * object, the content that can follow the SOAPBody object in a * SOAPEnvelope object, or what can follow the detail element * in a SOAPFault object. It is * the base class for all of the classes that represent the SOAP objects as * defined in the SOAP specification. */ public interface SOAPElement extends Node { /** * Creates a new SOAPElement object initialized with the * given Name object and adds the new element to this * SOAPElement object. * @param name a Name object with the XML name for the * new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the * SOAPElement object */ public abstract SOAPElement addChildElement(Name name) throws SOAPException; /** * Creates a new SOAPElement object initialized with the * given String object and adds the new element to this * SOAPElement object. * @param localName a String giving the local name for * the element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the * SOAPElement object */ public abstract SOAPElement addChildElement(String localName) throws SOAPException; /** * Creates a new SOAPElement object initialized with the * specified local name and prefix and adds the new element to this * SOAPElement object. * @param localName a String giving the local name for * the new element * @param prefix a String giving the namespace prefix for * the new element * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the * SOAPElement object */ public abstract SOAPElement addChildElement(String localName, String prefix) throws SOAPException; /** * Creates a new SOAPElement object initialized with the * specified local name, prefix, and URI and adds the new element to this * SOAPElement object. * @param localName a String giving the local name for * the new element * @param prefix a String giving the namespace prefix for * the new element * @param uri a String giving the URI of the namespace * to which the new element belongs * @return the new SOAPElement object that was created * @throws SOAPException if there is an error in creating the * SOAPElement object */ public abstract SOAPElement addChildElement( String localName, String prefix, String uri) throws SOAPException; /** * Add a SOAPElement as a child of this * SOAPElement instance. The SOAPElement * is expected to be created by a * SOAPElementFactory. 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 SOAPElement passed into an instance of * a different SOAPElement implementation. For * instance if addChildElement() is called on a * SOAPHeader, element will be copied * into an instance of a SOAPHeaderElement. * *

The fragment rooted in element is either added * as a whole or not at all, if there was an error. * *

The fragment rooted in element 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 SOAPElement to be added as a * new child * @return an instance representing the new SOAP element that was * actually added to the tree. * @throws SOAPException if there was an error in adding this * element as a child */ public abstract SOAPElement addChildElement(SOAPElement element) throws SOAPException; /** * Creates a new Text object initialized with the given * String and adds it to this SOAPElement object. * @param text a String object with the textual content to be added * @return the SOAPElement object into which * the new Text object was inserted * @throws SOAPException if there is an error in creating the * new Text object */ public abstract SOAPElement addTextNode(String text) throws SOAPException; /** * Adds an attribute with the specified name and value to this * SOAPElement object. *

* @param name a Name object with the name of the attribute * @param value a String giving the value of the attribute * @return the SOAPElement object into which the attribute was * inserted * @throws SOAPException if there is an error in creating the * Attribute */ public abstract SOAPElement addAttribute(Name name, String value) throws SOAPException; /** * Adds a namespace declaration with the specified prefix and URI to this * SOAPElement object. *

* @param prefix a String giving the prefix of the namespace * @param uri a String giving * the prefix of the namespace * @return the SOAPElement object into which this * namespace declaration was inserted. * @throws SOAPException if there is an error in creating the * namespace */ public abstract SOAPElement addNamespaceDeclaration( String prefix, String uri) throws SOAPException; /** * Returns the value of the attribute with the specified * name. * @param name a Name object with * the name of the attribute * @return a String giving the value of the * specified attribute */ public abstract String getAttributeValue(Name name); /** * Returns an iterator over all of the attribute names in * this SOAPElement object. The iterator can be * used to get the attribute names, which can then be passed to * the method getAttributeValue to retrieve the * value of each attribute. * @return an iterator over the names of the attributes */ public abstract Iterator getAllAttributes(); /** * Returns the URI of the namespace that has the given * prefix. * * @param prefix a String giving * the prefix of the namespace for which to search * @return a String with the uri of the namespace * that has the given prefix */ public abstract String getNamespaceURI(String prefix); /** * Returns an iterator of namespace prefixes. The iterator * can be used to get the namespace prefixes, which can then be * passed to the method getNamespaceURI to retrieve * the URI of each namespace. * @return an iterator over the namespace prefixes in this * SOAPElement object */ public abstract Iterator getNamespacePrefixes(); /** * Returns the name of this SOAPElement * object. * @return a Name object with the name of this * SOAPElement object */ public abstract Name getElementName(); /** * Removes the attribute with the specified name. * @param name the Name object with * the name of the attribute to be removed * @return true if the attribute was removed * successfully; false if it was not */ public abstract boolean removeAttribute(Name name); /** * Removes the namespace declaration corresponding to the * given prefix. * @param prefix a String giving * the prefix for which to search * @return true if the namespace declaration was * removed successfully; false if it was * not */ public abstract boolean removeNamespaceDeclaration(String prefix); /** * Returns an iterator over all the immediate content of * this element. This includes Text objects as well * as SOAPElement objects. * @return an iterator with the content of this * SOAPElement object */ public abstract Iterator getChildElements(); /** * Returns an iterator over all the child elements with the * specified name. * @param name a Name object with * the name of the child elements to be returned * @return an Iterator object over all the elements * in this SOAPElement object with the * specified name */ public abstract Iterator getChildElements(Name name); /** * Sets the encoding style for this SOAPElement * object to one specified. * @param encodingStyle a String * giving the encoding style * @throws SOAPException if * there was a problem in the encoding style being set. * @see #getEncodingStyle() getEncodingStyle() */ public abstract void setEncodingStyle(String encodingStyle) throws SOAPException; /** * Returns the encoding style for this * SOAPElement object. * @return a String giving the encoding style * @see #setEncodingStyle(java.lang.String) setEncodingStyle(java.lang.String) */ public abstract String getEncodingStyle(); } 1.1 xml-axis/java/src/javax/xml/soap/SOAPElementFactory.java Index: SOAPElementFactory.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** *

SOAPElementFactory is a factory for XML * fragments that will eventually end up in the SOAP part. These * fragments can be inserted as children of the * SOAPHeader or SOAPBody or * SOAPEnvelope.

* *

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.

*/ public abstract class SOAPElementFactory { /** */ public SOAPElementFactory() {} /** * Create a SOAPElement object initialized with * the given Name object. * @param name a Name object with * the XML name for the new element * @return the new SOAPElement object that was * created * @throws SOAPException if there is an error in * creating the SOAPElement object */ public abstract SOAPElement create(Name name) throws SOAPException; /** * Create a SOAPElement object initialized with * the given local name. * @param localName a String giving * the local name for the new element * @return the new SOAPElement object that was * created * @throws SOAPException if there is an error in * creating the SOAPElement object */ public abstract SOAPElement create(String localName) throws SOAPException; /** * TODO: Create a new SOAPElement object with the * given local name, prefix and uri. * @param localName a String giving * the local name for the new element * @param prefix the prefix for this * SOAPElement * @param uri a String giving the * URI of the namespace to which the new element * belongs * @return the new SOAPElement object that was * created * @throws SOAPException if there is an error in * creating the SOAPElement object */ public abstract SOAPElement create( String localName, String prefix, String uri) throws SOAPException; /** * Creates a new instance of * SOAPElementFactory. * @return a new instance of a * SOAPElementFactory * @throws SOAPException if there was an error creating * the default SOAPElementFactory */ public static SOAPElementFactory newInstance() throws SOAPException { try { return (SOAPElementFactory) FactoryFinder.find( "javax.xml.soap.SOAPElementFactory", "com.sun.xml.messaging.soap.SOAPElementFactoryImpl"); } catch (Exception exception) { throw new SOAPException("Unable to create SOAP Element Factory: " + exception.getMessage()); } } /** */ private static final String SEF_PROPERTY = "javax.xml.soap.SOAPElementFactory"; /** */ private static final String DEFAULT_SEF = "com.sun.xml.messaging.soap.SOAPElementFactoryImpl"; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPEnvelope.java Index: SOAPEnvelope.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * The container for the SOAPHeader and SOAPBody portions of a * SOAPPart object. By default, a * SOAPMessage object is created with a * SOAPPart object that has a SOAPEnvelope * object. The SOAPEnvelope object by default has an * empty SOAPBody object and an empty * SOAPHeader object. The SOAPBody object is * required, and the SOAPHeader object, though * optional, is used in the majority of cases. If the * SOAPHeader object is not needed, it can be deleted, * which is shown later.

* *

A client can access the SOAPHeader and * SOAPBody objects by calling the methods * SOAPEnvelope.getHeader and * SOAPEnvelope.getBody. The following lines of code use * these two methods after starting with the * SOAPMessage object message to get the * SOAPPart object sp, which is then used to get the * SOAPEnvelope object se.

*
   *    SOAPPart sp = message.getSOAPPart();
   *    SOAPEnvelope se = sp.getEnvelope();
   *    SOAPHeader sh = se.getHeader();
   *    SOAPBody sb = se.getBody();
   * 
* *

It is possible to change the body or header of a * SOAPEnvelope object by retrieving the current one, * deleting it, and then adding a new body or header. The * javax.xml.soap.Node method deleteNode * deletes the XML element (node) on which it is called. For * example, the following line of code deletes the * SOAPBody object that is retrieved by the method * getBody.

*
   *     se.getBody().detachNode();
   * 
* To create a SOAPHeader object to replace the one * that was removed, a client uses the method * SOAPEnvelope.addHeader, which creates a new header and * adds it to the SOAPEnvelope object. Similarly, the * method addBody creates a new SOAPBody * object and adds it to the SOAPEnvelope 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. *
   *    SOAPPart sp = message.getSOAPPart();
   *    SOAPEnvelope se = sp.getEnvelope();
   *    se.getHeader().detachNode();
   *    SOAPHeader sh = se.addHeader();
   *    se.getBody().detachNode();
   *    SOAPBody sb = se.addBody();
   * 
* It is an error to add a SOAPBody or * SOAPHeader object if one already exists. * *

The SOAPEnvelope interface provides three * methods for creating Name objects. One method * creates Name objects with a local name, a * namespace prefix, and a namesapce URI. The second method * creates Name objects with a local name and a * namespace prefix, and the third creates Name * objects with just a local name. The following line of code, in * which se is a SOAPEnvelope object, creates * a new Name object with all three.

*
   *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
   *                               "http://www.wombat.org/trader");
   * 
*/ public interface SOAPEnvelope extends SOAPElement { /** * Creates a new Name object initialized with the * given local name, namespace prefix, and namespace URI. * *

This factory method creates Name objects * for use in the SOAP/XML document. * @param localName a String giving * the local name * @param prefix a String giving * the prefix of the namespace * @param uri a String giving the * URI of the namespace * @return a Name 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 Name object initialized with the * given local name. * *

This factory method creates Name objects * for use in the SOAP/XML document. * * @param localName a String giving the local name * @return a Name 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 SOAPHeader object for this * SOAPEnvelope object. * *

A new SOAPMessage object is by default * created with a SOAPEnvelope object that * contains an empty SOAPHeader object. As a * result, the method getHeader will always * return a SOAPHeader object unless the header * has been removed and a new one has not been added. * @return the SOAPHeader object or * null if there is none * @throws SOAPException if there is a problem * obtaining the SOAPHeader object */ public abstract SOAPHeader getHeader() throws SOAPException; /** * Returns the SOAPBody object associated with * this SOAPEnvelope object. * *

A new SOAPMessage object is by default * created with a SOAPEnvelope object that * contains an empty SOAPBody object. As a * result, the method getBody will always return * a SOAPBody object unless the body has been * removed and a new one has not been added. * @return the SOAPBody object for this * SOAPEnvelope object or null if there * is none * @throws SOAPException if there is a problem * obtaining the SOAPBody object */ public abstract SOAPBody getBody() throws SOAPException; /** * Creates a SOAPHeader object and sets it as the * SOAPHeader object for this * SOAPEnvelope object. * *

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 SOAPHeader object * @throws SOAPException if this * SOAPEnvelope object already contains a valid * SOAPHeader object */ public abstract SOAPHeader addHeader() throws SOAPException; /** * Creates a SOAPBody object and sets it as the * SOAPBody object for this * SOAPEnvelope object. * *

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 SOAPBody object * @throws SOAPException if this * SOAPEnvelope object already contains a valid * SOAPBody object */ public abstract SOAPBody addBody() throws SOAPException; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPException.java Index: SOAPException.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * An exception that signals that a SOAP exception has * occurred. A SOAPException object may contain a * String that gives the reason for the exception, an * embedded Throwable object, or both. This class * provides methods for retrieving reason messages and for * retrieving the embedded Throwable object.

* *

Typical reasons for throwing a SOAPException * 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 * Throwable 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 { /** * Constructs a SOAPException object with no * reason or embedded Throwable object. */ public SOAPException() { cause = null; } /** * Constructs a SOAPException object with the * given String as the reason for the exception * being thrown. * @param reason a description of what caused * the exception */ public SOAPException(String reason) { super(reason); cause = null; } /** * Constructs a SOAPException object with the * given String as the reason for the exception * being thrown and the given Throwable object as * an embedded exception. * @param reason a description of what caused * the exception * @param cause a Throwable object * that is to be embedded in this SOAPException * object */ public SOAPException(String reason, Throwable cause) { super(reason); initCause(cause); } /** * Constructs a SOAPException object * initialized with the given Throwable * object. * @param cause a Throwable object * that is to be embedded in this SOAPException * object */ public SOAPException(Throwable cause) { super(cause.toString()); initCause(cause); } /** * Returns the detail message for this * SOAPException object. * *

If there is an embedded Throwable object, * and if the SOAPException object has no detail * message of its own, this method will return the detail * message from the embedded Throwable * object.

* @return the error or warning message for this * SOAPException or, if it has none, the message of * the embedded Throwable object, if there is * one */ public String getMessage() { String s = super.getMessage(); if ((s == null) && (cause != null)) { return cause.getMessage(); } else { return s; } } /** * Returns the Throwable object embedded in * this SOAPException if there is one. Otherwise, * this method returns null. * @return the embedded Throwable object or * null if there is none */ public Throwable getCause() { return cause; } /** * Initializes the cause field of this * SOAPException object with the given * Throwable object. * *

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 SOAPException * object. If this SOAPException object was * created with the constructor {@link #SOAPException(java.lang.Throwable) SOAPException(java.lang.Throwable)} * or {@link #SOAPException(java.lang.String, java.lang.Throwable) SOAPException(java.lang.String, java.lang.Throwable)}, meaning * that its cause field already has a value, this * method cannot be called even once. * * @param cause the Throwable * object that caused this SOAPException object * to be thrown. The value of this parameter is saved for * later retrieval by the * getCause() method. A null value * is permitted and indicates that the cause is nonexistent * or unknown. * @return a reference to this SOAPException * instance * @throws java.lang.IllegalArgumentException if * cause is this Throwable object. * (A Throwable object cannot be its own * cause.) * @throws java.lang.IllegalStateException if this * SOAPException object was created with {@link #SOAPException(java.lang.Throwable) SOAPException(java.lang.Throwable)} * or {@link #SOAPException(java.lang.String, java.lang.Throwable) SOAPException(java.lang.String, java.lang.Throwable)}, or this * method has already been called on this * SOAPException object */ 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"); } else { this.cause = cause; return this; } } /** TODO: Put description here. */ private Throwable cause; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPFault.java Index: SOAPFault.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * An element in the SOAPBody object that contains * error and/or status information. This information may relate to * errors in the SOAPMessage 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. *

* The SOAPFault interface provides methods for * retrieving the information contained in a * SOAPFault object and for setting the fault code, the * fault actor, and a string describing the fault. A fault code is * one of the codes defined in the SOAP 1.1 specification that * describe the fault. An actor is an intermediate recipient to * whom a message was routed. The message path may include one or * more actors, or, if no actors are specified, the message goes * only to the default actor, which is the final intended * recipient. */ public interface SOAPFault extends SOAPBodyElement { /** * Sets this SOAPFault object with the given * fault code. * *

Fault codes, which given information about the fault, * are defined in the SOAP 1.1 specification.

* @param faultCode a String giving * the fault code to be set; must be one of the fault codes * defined in the SOAP 1.1 specification * @throws SOAPException if there was an error in * adding the faultCode to the underlying XML * tree. */ public abstract void setFaultCode(String faultCode) throws SOAPException; /** * Gets the fault code for this SOAPFault * object. * @return a String with the fault code */ public abstract String getFaultCode(); /** * Sets this SOAPFault object with the given * fault actor. * *

The fault actor is the recipient in the message path who * caused the fault to happen.

* @param faultActor a String * identifying the actor that caused this * SOAPFault object * @throws SOAPException if there was an error in * adding the faultActor to the underlying XML * tree. */ public abstract void setFaultActor(String faultActor) throws SOAPException; /** * Gets the fault actor for this SOAPFault * object. * @return a String giving the actor in the message * path that caused this SOAPFault object * @see #setFaultActor(java.lang.String) setFaultActor(java.lang.String) */ public abstract String getFaultActor(); /** * Sets the fault string for this SOAPFault * object to the given string. * * @param faultString a String * giving an explanation of the fault * @throws SOAPException if there was an error in * adding the faultString to the underlying XML * tree. * @see #getFaultString() getFaultString() */ public abstract void setFaultString(String faultString) throws SOAPException; /** * Gets the fault string for this SOAPFault * object. * @return a String giving an explanation of the * fault */ public abstract String getFaultString(); /** * Returns the detail element for this SOAPFault * object. * *

A Detail object carries * application-specific error information related to * SOAPBodyElement objects.

* @return a Detail object with * application-specific error information */ public abstract Detail getDetail(); /** * Creates a Detail object and sets it as the * Detail object for this SOAPFault * object. * *

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 Detail object * @throws SOAPException if this * SOAPFault object already contains a valid * Detail object */ public abstract Detail addDetail() throws SOAPException; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPFaultElement.java Index: SOAPFaultElement.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** TODO: Put description here. */ public interface SOAPFaultElement extends SOAPElement {} 1.1 xml-axis/java/src/javax/xml/soap/SOAPHeader.java Index: SOAPHeader.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import java.util.Iterator; /** *

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 * SOAPHeader object.

* *

A SOAPEnvelope object contains an empty * SOAPHeader object by default. If the * SOAPHeader object, which is optional, is not needed, it * can be retrieved and deleted with the following line of code. * The variable se is a SOAPEnvelope * object.

*
   *     se.getHeader().detachNode();
   * 
* A SOAPHeader object is created with the * SOAPEnvelope method addHeader. This method, * which creates a new header and adds it to the envelope, may be * called only after the existing header has been removed. *
   *     se.getHeader().detachNode();
   *     SOAPHeader sh = se.addHeader();
   * 
* *

A SOAPHeader object can have only * SOAPHeaderElement objects as its immediate children. The * method addHeaderElement creates a new * HeaderElement object and adds it to the * SOAPHeader object. In the following line of code, the * argument to the method addHeaderElement is a * Name object that is the name for the new * HeaderElement object.

*
   *     SOAPHeaderElement shElement = sh.addHeaderElement(name);
   * 
* @see SOAPHeaderElement SOAPHeaderElement */ public interface SOAPHeader extends SOAPElement { /** * Creates a new SOAPHeaderElement object * initialized with the specified name and adds it to this * SOAPHeader object. * @param name a Name object with * the name of the new SOAPHeaderElement * object * @return the new SOAPHeaderElement object that * was inserted into this SOAPHeader * object * @throws SOAPException if a SOAP error occurs */ public abstract SOAPHeaderElement addHeaderElement(Name name) throws SOAPException; /** * Returns a list of all the SOAPHeaderElement * objects in this SOAPHeader object that have the * the specified actor. An actor is a global attribute that * indicates the intermediate parties to whom the message should * be sent. An actor receives the message and then sends it to * the next actor. The default actor is the ultimate intended * recipient for the message, so if no actor attribute is * included in a SOAPHeader object, the message is * sent to its ultimate destination. * @param actor a String giving the * URI of the actor for which to search * @return an Iterator object over all the * SOAPHeaderElement objects that contain the * specified actor * @see #extractHeaderElements(java.lang.String) extractHeaderElements(java.lang.String) */ public abstract Iterator examineHeaderElements(String actor); /** * Returns a list of all the SOAPHeaderElement * objects in this SOAPHeader object that have * the the specified actor and detaches them from this * SOAPHeader object. * *

This method allows an actor to process only the parts of * the SOAPHeader object that apply to it and to * remove them before passing the message on to the next * actor. * @param actor a String giving the * URI of the actor for which to search * @return an Iterator object over all the * SOAPHeaderElement objects that contain the * specified actor * @see #examineHeaderElements(java.lang.String) examineHeaderElements(java.lang.String) */ public abstract Iterator extractHeaderElements(String actor); } 1.1 xml-axis/java/src/javax/xml/soap/SOAPHeaderElement.java Index: SOAPHeaderElement.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** *

An object representing the contents in the SOAP header part * of the SOAP envelope. The immediate children of a * SOAPHeader object can be represented only as * SOAPHeaderElement objects.

* *

A SOAPHeaderElement object can have other * SOAPElement objects as its children.

*/ public interface SOAPHeaderElement extends SOAPElement { /** * Sets the actor associated with this * SOAPHeaderElement object to the specified actor. The * default value of an actor is: * SOAPConstants.URI_SOAP_ACTOR_NEXT * @param actorURI a String giving * the URI of the actor to set * @see #getActor() getActor() * @throws java.lang.IllegalArgumentException if * there is a problem in setting the actor. */ public abstract void setActor(String actorURI); /** * Returns the uri of the actor associated with this * SOAPHeaderElement object. * @return a String giving the URI of the * actor * @see #setActor() setActor() */ public abstract String getActor(); /** * Sets the mustUnderstand attribute for this * SOAPHeaderElement object to be on or off. * *

If the mustUnderstand attribute is on, the actor who * receives the SOAPHeaderElement must process it * correctly. This ensures, for example, that if the * SOAPHeaderElement object modifies the message, that * the message is being modified correctly.

* @param mustUnderstand true to * set the mustUnderstand attribute on; false * to turn if off * @throws java.lang.IllegalArgumentException if * there is a problem in setting the actor. * @see #getMustUnderstand() getMustUnderstand() */ public abstract void setMustUnderstand(boolean mustUnderstand); /** * Returns whether the mustUnderstand attribute for this * SOAPHeaderElement object is turned on. * @return true if the mustUnderstand attribute of * this SOAPHeaderElement object is turned on; * false otherwise */ public abstract boolean getMustUnderstand(); } 1.1 xml-axis/java/src/javax/xml/soap/SOAPMessage.java Index: SOAPMessage.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import javax.activation.DataHandler; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; /** *

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.

* *

A SOAPMessage object consists of a SOAP part * and optionally one or more attachment parts. The SOAP part for * a SOAPMessage object is a SOAPPart * 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.

* *

A new SOAPMessage object contains the following * by default:

* *
    *
  • A SOAPPart object
  • * *
  • A SOAPEnvelope object
  • * *
  • A SOAPBody object
  • * *
  • A SOAPHeader object
  • *
* The SOAP part of a message can be retrieved by calling the * method SOAPMessage.getSOAPPart(). The * SOAPEnvelope object is retrieved from the * SOAPPart object, and the SOAPEnvelope * object is used to retrieve the SOAPBody and * SOAPHeader objects. *
   * SOAPPart sp = message.getSOAPPart();
   * SOAPEnvelope se = sp.getEnvelope();
   * SOAPBody sb = se.getBody();
   * SOAPHeader sh = se.getHeader();
   * 
* *

In addition to the mandatory SOAPPart object, a * SOAPMessage object may contain zero or more * AttachmentPart objects, each of which contains * application-specific data. The SOAPMessage * interface provides methods for creating * AttachmentPart objects and also for adding them to a * SOAPMessage object. A party that has received a * SOAPMessage object can examine its contents by * retrieving individual attachment parts.

* *

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 * AttachmentPart object.

* *

A MessageFactory object creates new * SOAPMessage objects. If the MessageFactory * object was initialized with a messaging Profile, it produces * SOAPMessage objects that conform to that Profile. * For example, a SOAPMessage object created by a * MessageFactory object initialized with the ebXML * Profile will have the appropriate ebXML headers.

* @see MessageFactory MessageFactory * @see AttachmentPart AttachmentPart */ public abstract class SOAPMessage { /** */ public SOAPMessage() {} /** * Retrieves a description of this SOAPMessage * object's content. * @return a String describing the content of this * message or null if no description has been * set * @see #setContentDescription(java.lang.String) setContentDescription(java.lang.String) */ public abstract String getContentDescription(); /** * Sets the description of this SOAPMessage * object's content with the given description. * @param description a String * describing the content of this message * @see #getContentDescription() getContentDescription() */ public abstract void setContentDescription(String description); /** * Gets the SOAP part of this SOAPMessage object. * * *

If a SOAPMessage object contains one or * more attachments, the SOAP Part must be the first MIME body * part in the message.

* @return the SOAPPart object for this * SOAPMessage object */ public abstract SOAPPart getSOAPPart(); /** * Removes all AttachmentPart objects that have * been added to this SOAPMessage object. * *

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 AttachmentPart objects * that are part of this SOAPMessage * object */ public abstract int countAttachments(); /** * Retrieves all the AttachmentPart objects * that are part of this SOAPMessage object. * @return an iterator over all the attachments in this * message */ public abstract Iterator getAttachments(); /** * Retrieves all the AttachmentPart 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 MimeHeaders * 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); /** * Adds the given AttachmentPart object to this * SOAPMessage object. An * AttachmentPart object must be created before it can be * added to a message. * @param attachmentpart an * AttachmentPart object that is to become part of * this SOAPMessage object * @throws java.lang.IllegalArgumentException */ public abstract void addAttachmentPart(AttachmentPart attachmentpart); /** * Creates a new empty AttachmentPart object. * Note that the method addAttachmentPart must be * called with this new AttachmentPart object as * the parameter in order for it to become an attachment to this * SOAPMessage object. * @return a new AttachmentPart object that can be * populated and added to this SOAPMessage * object */ public abstract AttachmentPart createAttachmentPart(); /** * Creates an AttachmentPart object and * populates it using the given DataHandler * object. * @param datahandler the * javax.activation.DataHandler object that will * generate the content for this SOAPMessage * object * @return a new AttachmentPart object that * contains data generated by the given * DataHandler object * @throws java.lang.IllegalArgumentException if * there was a problem with the specified * DataHandler object * @see DataHandler DataHandler * @see DataContentHandler DataContentHandler */ public AttachmentPart createAttachmentPart(DataHandler datahandler) { AttachmentPart attachmentpart = createAttachmentPart(); attachmentpart.setDataHandler(datahandler); return attachmentpart; } /** * Returns all the transport-specific MIME headers for this * SOAPMessage object in a transport-independent * fashion. * @return a MimeHeaders object containing the * MimeHeader objects */ public abstract MimeHeaders getMimeHeaders(); /** * Creates an AttachmentPart object and * populates it with the specified data of the specified content * type. * @param content an Object * containing the content for this SOAPMessage * object * @param contentType a String * object giving the type of content; examples are * "text/xml", "text/plain", and "image/jpeg" * @return a new AttachmentPart object that * contains the given data * @throws java.lang.IllegalArgumentException if the contentType does not match the type of the content * object, or if there was no * DataContentHandler object for the given content * object * @see DataHandler DataHandler * @see DataContentHandler DataContentHandler */ public AttachmentPart createAttachmentPart(Object content, String contentType) { AttachmentPart attachmentpart = createAttachmentPart(); attachmentpart.setContent(content, contentType); return attachmentpart; } /** * Updates this SOAPMessage object with all the * changes that have been made to it. This method is called * automatically when a message is sent or written to by the * methods ProviderConnection.send, * SOAPConnection.call, or * SOAPMessage.writeTo. However, if changes are made to * a message that was received or to one that has already been * sent, the method saveChanges needs to be * called explicitly in order to save the changes. The method * saveChanges 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 saveChanges has been * called. * *

In addition, this method marks the point at which the * data from all constituent AttachmentPart * objects are pulled into the message.

* @throws SOAPException if there * was a problem saving changes to this message. */ public abstract void saveChanges() throws SOAPException; /** * Indicates whether this SOAPMessage object * has had the method saveChanges called on * it. * @return true if saveChanges has * been called on this message at least once; * false otherwise. */ public abstract boolean saveRequired(); /** * TODO: Writes this SOAPMessage object to the given * output stream. The externalization format is as defined by * the SOAP 1.1 with Attachments specification. * *

If there are no attachments, just an XML stream is * written out. For those messages that have attachments, * writeTo writes a MIME-encoded byte stream.

* @param out the OutputStream * object to which this SOAPMessage object will * be written * @throws SOAPException if there was a problem in * externalizing this SOAP message * @throws IOException if an I/O error * occurs */ public abstract void writeTo(OutputStream out) throws SOAPException, IOException; } 1.1 xml-axis/java/src/javax/xml/soap/SOAPPart.java Index: SOAPPart.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; import javax.xml.transform.Source; import java.util.Iterator; /** *

The container for the SOAP-specific portion of a * SOAPMessage object. All messages are required to have a * SOAP part, so when a SOAPMessage object is * created, it will automatically have a SOAPPart * object.

* *

A SOAPPart 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 * SOAPPart 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 AttachmentPart object rather than in * the SOAPPart object.

* *

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".

* *

A client can access the SOAPPart object of a * SOAPMessage object by calling the method * SOAPMessage.getSOAPPart. The following line of code, in * which message is a SOAPMessage * object, retrieves the SOAP part of a message.

*
   * SOAPPart soapPart = message.getSOAPPart();
   * 
* *

A SOAPPart object contains a * SOAPEnvelope object, which in turn contains a * SOAPBody object and a SOAPHeader object. * The SOAPPart method getEnvelope can * be used to retrieve the SOAPEnvelope object.

*/ public abstract class SOAPPart { /** */ public SOAPPart() {} /** * Gets the SOAPEnvelope object associated with * this SOAPPart object. Once the SOAP envelope is * obtained, it can be used to get its contents. * @return the SOAPEnvelope object for this * SOAPPart object * @throws 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 String giving the value of the MIME * header named "Content-Id" * @see #setContentId(java.lang.String) setContentId(java.lang.String) */ public String getContentId() { String as[] = getMimeHeader("Content-Id"); if (as != null) { return as[0]; } else { return null; } } /** * Retrieves the value of the MIME header whose name is * "Content-Location". * @return a String giving the value of the MIME * header whose name is "Content-Location" * @see #setContentLocation(java.lang.String) setContentLocation(java.lang.String) */ public String getContentLocation() { String as[] = getMimeHeader("Content-Location"); if (as != null) { return as[0]; } else { return null; } } /** * Sets the value of the MIME header named "Content-Id" to * the given String. * @param contentId a String giving * the value of the MIME header "Content-Id" * @throws java.lang.IllegalArgumentException if * there is a problem in setting the content id * @see #getContentId() getContentId() */ public void setContentId(String contentId) { setMimeHeader("Content-Id", contentId); } /** * Sets the value of the MIME header "Content-Location" to * the given String. * @param contentLocation a String * giving the value of the MIME header * "Content-Location" * @throws java.lang.IllegalArgumentException if * there is a problem in setting the content location. * @see #getContentLocation() getContentLocation() */ public void setContentLocation(String contentLocation) { setMimeHeader("Content-Location", contentLocation); } /** * Removes all MIME headers that match the given name. * @param header a String giving * the name of the MIME header(s) to be removed */ public abstract void removeMimeHeader(String header); /** * Removes all the MimeHeader objects for this * SOAPEnvelope object. */ public abstract void removeAllMimeHeaders(); /** * Gets all the values of the MimeHeader object * in this SOAPPart object that is identified by * the given String. * @param name the name of the header; example: * "Content-Type" * @return a String array giving all the values for * the specified header * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String) */ 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. * *

Note that RFC822 headers can contain only US-ASCII * characters.

* @param name a String giving the * header name for which to search * @param value a String 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 MimeHeader object. * @ throws java.lang.IllegalArgumentException if * there was a problem with the specified mime header name * or value * @see #getMimeHeader(java.lang.String) getMimeHeader(java.lang.String) */ public abstract void setMimeHeader(String name, String value); /** * Creates a MimeHeader object with the specified * name and value and adds it to this SOAPPart * object. If a MimeHeader with the specified * name already exists, this method adds the specified value * to the already existing value(s). * *

Note that RFC822 headers can contain only US-ASCII * characters.

* * @param name a String giving the * header name * @param value a String giving the * value to be set or added * @throws java.lang.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 SOAPPart * object as an iterator over the MimeHeader * objects. * @return an Iterator object with all of the Mime * headers for this SOAPPart object */ public abstract Iterator getAllMimeHeaders(); /** * Retrieves all MimeHeader objects that match * a name in the given array. * @param names a String 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 Iterator * object */ public abstract Iterator getMatchingMimeHeaders(String names[]); /** * TODO: Retrieves all MimeHeader objects whose name * does not match a name in the given array. * @param names a String array with * the name(s) of the MIME headers not to be returned * @return all of the MIME headers in this SOAPPart * object except those that match one of the names in the * given array. The nonmatching MIME headers are returned as * an Iterator object. */ public abstract Iterator getNonMatchingMimeHeaders(String names[]); /** * Sets the content of the SOAPEnvelope object * with the data from the given Source object. * @param source javax.xml.transform.Source
object with the data to * be set * @throws SOAPException if there is a problem in * setting the source * @see #getContent() getContent() */ public abstract void setContent(Source source) throws SOAPException; /** * Returns the content of the SOAPEnvelope as a JAXP * Source object. * @return the content as a * javax.xml.transform.Source object * @throws SOAPException if the implementation cannot * convert the specified Source object * @see #setContent(javax.xml.transform.Source) setContent(javax.xml.transform.Source) */ public abstract Source getContent() throws SOAPException; } 1.1 xml-axis/java/src/javax/xml/soap/Text.java Index: Text.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.soap; /** * A representation of a node whose value is text. A * Text object may represent text that is content or text * that is a comment. */ public interface Text extends Node { /** * Retrieves whether this Text object * represents a comment. * @return true if this Text object is * a comment; false otherwise */ public abstract boolean isComment(); } 1.1 xml-axis/java/src/javax/xml/transform/Source.java Index: Source.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The name "Apache Software Foundation" must not be used to endorse or * promote products derived from this software without prior written * permission. For written permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ package javax.xml.transform; import java.lang.String; import java.io.InputStream; import java.io.Reader; /** * An object that implements this interface contains the information * needed to act as source input (XML source or transformation instructions). */ public interface Source { /** * Set the system identifier for this Source. * *

The system identifier is optional if the source does not * get its data from a URL, but it may still be useful to provide one. * The application can use a system identifier, for example, to resolve * relative URIs and to include in error messages and warnings.

* * @param systemId The system identifier as a URL string. */ public void setSystemId(String systemId); /** * Get the system identifier that was set with setSystemId. * * @return The system identifier that was set with setSystemId, or null * if setSystemId was not called. */ public String getSystemId(); }