Author: thomas.diesler(a)jboss.com
Date: 2006-12-13 08:13:27 -0500 (Wed, 13 Dec 2006)
New Revision: 1637
Added:
trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java
trunk/src/main/java/javax/xml/soap/SAAJResult.java
Modified:
trunk/src/main/java/javax/xml/soap/AttachmentPart.java
trunk/src/main/java/javax/xml/soap/Detail.java
trunk/src/main/java/javax/xml/soap/MessageFactory.java
trunk/src/main/java/javax/xml/soap/SOAPBody.java
trunk/src/main/java/javax/xml/soap/SOAPConnection.java
trunk/src/main/java/javax/xml/soap/SOAPConstants.java
trunk/src/main/java/javax/xml/soap/SOAPElement.java
trunk/src/main/java/javax/xml/soap/SOAPFactory.java
trunk/src/main/java/javax/xml/soap/SOAPFault.java
trunk/src/main/java/javax/xml/soap/SOAPHeader.java
trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java
trunk/src/main/java/javax/xml/soap/SOAPMessage.java
trunk/src/main/java/javax/xml/soap/SOAPPart.java
trunk/src/main/java/org/jboss/ws/Constants.java
trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java
Log:
Update to SAAJ 1.3
Modified: trunk/src/main/java/javax/xml/soap/AttachmentPart.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/AttachmentPart.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/AttachmentPart.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -21,65 +21,71 @@
*/
package javax.xml.soap;
+import java.io.InputStream;
import java.util.Iterator;
import javax.activation.DataHandler;
/**
- * 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</li>
- * 2. It MUST contain content</li>
- * 3. 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");
- *
- * 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();
- *
+ 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,
applicationspecific
+ 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 (
http://www.ietf.org/rfc/rfc2045.txt)
+ 2. It MUST contain content
+ 3. 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”);
+
+ 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();
+
* @author Scott.Stark(a)jboss.org
* @version $Revision$
*/
@@ -135,6 +141,40 @@
public abstract Object getContent() throws SOAPException;
/**
+ * Returns an InputStream which can be used to obtain the content of AttachmentPart as
Base64 encoded character data,
+ * this method would base64 encode the raw bytes of the attachment and return.
+ *
+ * @return an InputStream from which the Base64 encoded AttachmentPart can be read.
+ * @throws SOAPException if there is no content set into this AttachmentPart object or
if there was a data transformation error.
+ * @since SAAJ 1.3
+ */
+ public abstract InputStream getBase64Content() throws SOAPException;
+
+ /**
+ * Gets the content of this AttachmentPart object as an InputStream as if a call had
been made to getContent and no DataContentHandler
+ * had been registered for the content-type of this AttachmentPart.
+ *
+ * Note that reading from the returned InputStream would result in consuming the data
in the stream.
+ * It is the responsibility of the caller to reset the InputStream appropriately
before calling a Subsequent API.
+ * If a copy of the raw attachment content is required then the getRawContentBytes()
API should be used instead.
+ *
+ * @return an InputStream from which the raw data contained by the AttachmentPart can
be accessed.
+ * @throws SOAPException if there is no content set into this AttachmentPart object or
if there was a data transformation error.
+ * @since SAAJ 1.3
+ */
+ public abstract java.io.InputStream getRawContent() throws SOAPException;
+
+ /**
+ * Gets the content of this AttachmentPart object as a byte[] array as if a call had
been
+ * made to getContent and no DataContentHandler had been registered for the
content-type of this AttachmentPart.
+ *
+ * @return a byte[] array containing the raw data of the AttachmentPart.
+ * @throws SOAPException if there is no content set into this AttachmentPart object or
if there was a data transformation error.
+ * @since SAAJ 1.3
+ */
+ public abstract byte[] getRawContentBytes() throws SOAPException;
+
+ /**
* Gets the DataHandler object for this AttachmentPart object.
* @return object associated with this AttachmentPart object
* @throws SOAPException if there is no data in this AttachmentPart object
@@ -194,6 +234,46 @@
public abstract void setContent(Object object, String contentType);
/**
+ * Sets the content of this attachment part to that contained by the InputStream
content and sets the value of the Content-Type header to the value contained in
contentType.
+ *
+ * A subsequent call to getSize() may not be an exact measure of the content size.
+ *
+ * @param content the raw data to add to the attachment part
+ * @param contentType the value to set into the Content-Type header
+ * @throws SOAPException if an there is an error in setting the content
+ * @throws NullPointerException if content is null
+ * @since SAAJ 1.3
+ */
+ public abstract void setRawContent(InputStream content, String contentType) throws
SOAPException;
+
+ /**
+ * Sets the content of this attachment part to that contained by the byte[] array
content and sets the value of the Content-Type
+ * header to the value contained in contentType.
+ *
+ * @param content the raw data to add to the attachment part
+ * @param contentType the value to set into the Content-Type header
+ * @param offset the offset in the byte array of the content
+ * @param len the number of bytes that form the content
+ * @throws SOAPException if an there is an error in setting the content or content is
null
+ * @since SAAJ 1.3
+ */
+ public abstract void setRawContentBytes(byte[] content, int offset, int len, String
contentType) throws SOAPException;
+
+ /**
+ * Sets the content of this attachment part from the Base64 source InputStream and
sets the value of the Content-Type header
+ * to the value contained in contentType, This method would first decode the base64
input and write the resulting raw bytes to the attachment.
+ *
+ * A subsequent call to getSize() may not be an exact measure of the content size.
+ *
+ * @param content the base64 encoded data to add to the attachment part
+ * @param contentType the value to set into the Content-Type header
+ * @throws SOAPException if an there is an error in setting the content
+ * @throws NullPointerException if content is null
+ * @since SAAJ 1.3
+ */
+ public abstract void setBase64Content(InputStream content, String contentType) 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
Modified: trunk/src/main/java/javax/xml/soap/Detail.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/Detail.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/javax/xml/soap/Detail.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -23,33 +23,52 @@
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();
+import javax.xml.namespace.QName;
+/**
+ 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();
+
* @author Scott.Stark(a)jboss.org
* @version $Revision$
*/
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
+ * @throws SOAPException thrown when there is a problem in adding a DetailEntry object
to this Detail object.
+ */
public DetailEntry addDetailEntry(Name name) throws SOAPException;
+ /**
+ * Creates a new DetailEntry object with the given QName and adds it to this Detail
object.
+ * This method is the preferred over the one using Name.
+ *
+ * @param qname a QName object identifying the new DetailEntry object
+ * @throws SOAPException thrown when there is a problem in adding a DetailEntry object
to this Detail object.
+ * @since SAAJ 1.3
+ */
+ public DetailEntry addDetailEntry(QName qname) throws SOAPException;
+
+ /**
+ * Gets an Iterator over all of the DetailEntrys in this Detail object.
+ * @return an Iterator object over the DetailEntry objects in this Detail object
+ */
public Iterator getDetailEntries();
}
Modified: trunk/src/main/java/javax/xml/soap/MessageFactory.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/MessageFactory.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/MessageFactory.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -27,33 +27,32 @@
import java.security.PrivilegedAction;
import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
/**
- * A factory for creating SOAPMessage objects.
+ A factory for creating SOAPMessage objects.
+
+ A SAAJ client can create a MessageFactory object using the method newInstance, as shown
in the following lines of code.
+
+ MessageFactory mf = MessageFactory.newInstance();
+ MessageFactory mf12 = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+
+
+ 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
+
+ In some cases, specialized MessageFactory objects may be obtained that produce messages
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()
+ 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.
+
*
- * A SAAJ client can 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
- *
- * MessageFactory objects can be initialized with a JAXM profile. In such a case 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.
- *
* @author Scott.Stark(a)jboss.org
* @version $Revision$
*/
@@ -61,55 +60,55 @@
{
// provide logging
private static Logger log = Logger.getLogger(MessageFactory.class);
-
+
private static final String DEFAULT_MESSAGE_FACTORY =
"org.jboss.ws.core.soap.MessageFactoryImpl";
- private static final String[] alternativeFactories = new String[] {
"org.jboss.axis.soap.MessageFactoryImpl" };
- /** Creates a new MessageFactory object that is an instance of the default
implementation.
+ /**
+ * Creates a new MessageFactory object that is an instance of the default
implementation (SOAP 1.1),
+ * This method uses the following ordered lookup procedure to determine the
MessageFactory implementation class to load:
+
+ * Use the javax.xml.soap.MessageFactory system property.
+ * Use the properties file "lib/jaxm.properties" in the JRE directory. This
configuration file is in standard java.util.Properties format and contains the fully
qualified name of the implementation class with the key being the system property defined
above.
+ * Use the Services API (as detailed in the JAR specification), if available, to
determine the classname. The Services API will look for a classname in the file
META-INF/services/javax.xml.soap.MessageFactory in jars available to the runtime.
+ * Use the SAAJMetaFactory instance to locate the MessageFactory implementation class.
*/
public static MessageFactory newInstance() throws SOAPException
{
PrivilegedAction action = new PropertyAccessAction(MessageFactory.class.getName(),
DEFAULT_MESSAGE_FACTORY);
String factoryName = (String)AccessController.doPrivileged(action);
+
+ //TODO: SAAJ 1.3 (implement the lookup)
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try
{
- try
- {
- Class factoryClass = loader.loadClass(factoryName);
- return (MessageFactory)factoryClass.newInstance();
- }
- catch (ClassNotFoundException e)
- {
- // Throw the exception if the user asked for a specific factory
- if (factoryName.equals(DEFAULT_MESSAGE_FACTORY) == false)
- throw e;
-
- for (int i = 0; i < alternativeFactories.length; i++)
- {
- factoryName = alternativeFactories[i];
- try
- {
- Class factoryClass = loader.loadClass(factoryName);
- return (MessageFactory)factoryClass.newInstance();
- }
- catch (ClassNotFoundException e1)
- {
- log.debug("Cannot load factory: " + factoryName);
- }
- }
- }
+ Class factoryClass = loader.loadClass(factoryName);
+ return (MessageFactory)factoryClass.newInstance();
}
catch (Throwable t)
{
throw new SOAPException("Failed to create MessageFactory: " +
factoryName, t);
}
-
- throw new SOAPException("Cannot find MessageFactory implementation");
}
/**
+ * Creates a new MessageFactory object that is an instance of the specified
implementation.
+ * May be a dynamic message factory, a SOAP 1.1 message factory, or a SOAP 1.2 message
factory.
+ * A dynamic message factory creates messages based on the MIME headers specified as
arguments to the createMessage method.
+ * This method uses the SAAJMetaFactory to locate the implementation class and create
the MessageFactory instance.
+ *
+ * @param protocol a string constant representing the class of the specified message
factory implementation.
+ * May be either DYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL (which is the same
as) SOAP_1_1_PROTOCOL, or SOAP_1_2_PROTOCOL.
+ * @throws SOAPException if there was an error in creating the specified
implementation of MessageFactory.
+ * @since SAAJ 1.3
+ */
+ public static MessageFactory newInstance(String protocol) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
* 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.
*
Added: trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package javax.xml.soap;
+
+import org.jboss.util.NotImplementedException;
+
+// $Id$
+
+/**
+ * The access point for the implementation classes of the factories defined in the SAAJ
API.
+ * All of the newInstance methods defined on factories in SAAJ 1.3 defer to instances of
this class to do the actual object creation.
+ * The implementations of newInstance() methods (in SOAPFactory and MessageFactory) that
existed in SAAJ 1.2
+ * have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2 defined
lookup fails to locate the Factory implementation class name.
+ *
+ * SAAJMetaFactory is a service provider interface. There are no public methods on this
class.
+ *
+ * @since SAAJ 1.3
+ */
+public abstract class SAAJMetaFactory
+{
+ protected SAAJMetaFactory()
+ {
+ }
+
+ /**
+ * Creates a new instance of a concrete SAAJMetaFactory object. The SAAJMetaFactory is
an SPI,
+ * it pulls the creation of the other factories together into a single place. Changing
out the SAAJMetaFactory
+ * has the effect of changing out the entire SAAJ implementation. Service providers
provide the name of their SAAJMetaFactory
+ * implementation. This method uses the following ordered lookup procedure to
determine the SAAJMetaFactory implementation class to load:
+ *
+ * - Use the javax.xml.soap.MetaFactory system property.
+ * - Use the properties file "lib/jaxm.properties" in the JRE directory.
This configuration file is in standard java.util.Properties format and contains the fully
qualified name of the implementation class with the key being the system property defined
above.
+ * - Use the Services API (as detailed in the JAR specification), if available, to
determine the classname. The Services API will look for a classname in the file
META-INF/services/javax.xml.soap.MetaFactory in jars available to the runtime.
+ * - Default to com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl.
+ *
+ * @return a concrete SAAJMetaFactory object
+ * @throws SOAPException if there is an error in creating the SAAJMetaFactory
+ */
+ static SAAJMetaFactory getInstance() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Creates a MessageFactory object for the given String protocol.
+ * @param protocol a String indicating the protocol (SOAPConstants.SOAP_1_1_PROTOCOL,
SOAPConstants.SOAP_1_2_PROTOCOL, SOAPConstants.DYNAMIC_SOAP_PROTOCOL)
+ * @throws SOAPException if there is an error in creating the MessageFactory
+ */
+ protected abstract MessageFactory newMessageFactory(String protocol) throws
SOAPException;
+
+ /**
+ * Creates a SOAPFactory object for the given String protocol.
+ * @param protocol a String indicating the protocol (SOAPConstants.SOAP_1_1_PROTOCOL,
SOAPConstants.SOAP_1_2_PROTOCOL, SOAPConstants.DYNAMIC_SOAP_PROTOCOL)
+ * @throws SOAPException if there is an error in creating the SOAPFactory
+ */
+ protected abstract SOAPFactory newSOAPFactory(String protocol) throws SOAPException;
+}
Property changes on: trunk/src/main/java/javax/xml/soap/SAAJMetaFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/src/main/java/javax/xml/soap/SAAJResult.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SAAJResult.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/javax/xml/soap/SAAJResult.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package javax.xml.soap;
+
+// $Id$
+
+import javax.xml.transform.dom.DOMResult;
+
+import org.jboss.util.NotImplementedException;
+
+/**
+ * Acts as a holder for the results of a JAXP transformation or a JAXB marshalling, in
the form of a SAAJ tree.
+ * These results should be accessed by using the getResult() method. The
DOMResult.getNode() method should be avoided in almost all cases.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since SAAJ 1.3
+ */
+public class SAAJResult extends DOMResult
+{
+ /**
+ * Creates a SAAJResult that will present results in the form of a SAAJ tree that
supports the default (SOAP 1.1) protocol.
+ *
+ * This kind of SAAJResult is meant for use in situations where the results will be
used as a parameter to a method that
+ * takes a parameter whose type, such as SOAPElement, is drawn from the SAAJ API. When
used in a transformation,
+ * the results are populated into the SOAPPart of a SOAPMessage that is created
internally.
+ * The SOAPPart returned by DOMResult.getNode() is not guaranteed to be well-formed.
+ * @throws SOAPException if there is a problem creating a SOAPMessage
+ * @since SAAJ 1.3
+ */
+ public SAAJResult() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Creates a SAAJResult that will present results in the form of a SAAJ tree that
supports the specified protocol.
+ * The DYNAMIC_SOAP_PROTOCOL is ambiguous in this context and will cause this
constructor to throw an UnsupportedOperationException.
+ *
+ * This kind of SAAJResult is meant for use in situations where the results will be
used as a parameter to a method that takes a parameter whose type, such as SOAPElement, is
drawn from the SAAJ API. When used in a transformation the results are populated into the
SOAPPart of a SOAPMessage that is created internally. The SOAPPart returned by
DOMResult.getNode() is not guaranteed to be well-formed.
+ *
+ * @param protocol the name of the SOAP protocol that the resulting SAAJ tree should
support
+ * @throws SOAPException if a SOAPMessage supporting the specified protocol cannot be
created
+ * @since SAAJ 1.3
+ */
+ public SAAJResult(String protocol) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Creates a SAAJResult that will write the results into the SOAPPart of the supplied
SOAPMessage.
+ * In the normal case these results will be written using DOM APIs and, as a result,
the finished SOAPPart
+ * will not be guaranteed to be well-formed unless the data used to create it is also
well formed. When used in a
+ * transformation the validity of the SOAPMessage after the transformation can be
guaranteed only by means outside SAAJ specification.
+ *
+ * @param message the message whose SOAPPart will be populated as a result of some
transformation or marshalling operation
+ * @since SAAJ 1.3
+ */
+ public SAAJResult(SOAPMessage message)
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Creates a SAAJResult that will write the results as a child node of the SOAPElement
specified.
+ * In the normal case these results will be written using DOM APIs and as a result may
invalidate the structure of the SAAJ tree.
+ * This kind of SAAJResult should only be used when the validity of the incoming data
can be guaranteed by means outside of the SAAJ specification.
+ *
+ * @param rootNode the root to which the results will be appended
+ * @since SAAJ 1.3
+ */
+ public SAAJResult(SOAPElement rootNode)
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
+ * @return the resulting Tree that was created under the specified root Node.
+ * @since SAAJ 1.3
+ */
+ public Node getResult()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+}
Property changes on: trunk/src/main/java/javax/xml/soap/SAAJResult.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/src/main/java/javax/xml/soap/SOAPBody.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPBody.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPBody.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -23,6 +23,8 @@
import java.util.Locale;
+import javax.xml.namespace.QName;
+
import org.w3c.dom.Document;
/** An object that represents the contents of the SOAP body element in a SOAP
@@ -46,6 +48,15 @@
*/
public abstract SOAPBodyElement addBodyElement(Name name) throws SOAPException;
+ /**
+ * Creates a new SOAPBodyElement object with the specified QName and adds it to this
SOAPBody object.
+ * @param qname a QName object with the qname for the new SOAPBodyElement object
+ * @return the new SOAPBodyElement object
+ * @throws SOAPException if a SOAP error occurs
+ * @since SAAJ 1.3
+ */
+ public abstract SOAPBodyElement addBodyElement(QName qname) throws SOAPException;
+
/** Adds the root node of the DOM Document to this SOAPBody object.
*
* Calling this method invalidates the document parameter.
@@ -81,6 +92,26 @@
* @throws SOAPException if there is a SOAP error
*/
public abstract SOAPFault addFault(Name faultCode, String faultString) throws
SOAPException;
+
+ /**
+ * Creates a new SOAPFault object and adds it to this SOAPBody object. The type of
the SOAPFault will be a SOAP 1.1 or a SOAP 1.2 SOAPFault
+ * depending on the protocol specified while creating the MessageFactory instance.
+ *
+ * For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element
and the faultString parameter is the value
+ * of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is the value
of the faultcode element and the
+ * faultString parameter is the value of the faultstring element.
+ *
+ * In case of a SOAP 1.2 fault, the default value for the mandatory xml:lang attribute
on the Fault/Reason/Text element will be
+ * set to java.util.Locale.getDefault()
+ *
+ * A SOAPBody may contain at most one SOAPFault child element
+ *
+ * @param faultCode a QName object giving the fault code to be set; must be one of the
fault codes defined in the version of SOAP specification in use
+ * @param faultString a String giving an explanation of the fault
+ * @throws SOAPException if there is a SOAP error
+ * @since SAAJ 1.3
+ */
+ public abstract SOAPFault addFault(QName faultCode, String faultString) throws
SOAPException;
/** Creates a new SOAPFault object and adds it to this SOAPBody object.
*
@@ -97,6 +128,25 @@
*/
public abstract SOAPFault addFault(Name faultCode, String faultString, Locale locale)
throws SOAPException;
+ /**
+ * Creates a new SOAPFault object and adds it to this SOAPBody object. The type of the
SOAPFault will be a SOAP 1.1 or a SOAP 1.2
+ * SOAPFault depending on the protocol specified while creating the MessageFactory
instance.
+ *
+ * For SOAP 1.2 the faultCode parameter is the value of the Fault/Code/Value element
and the faultString parameter is
+ * the value of the Fault/Reason/Text element. For SOAP 1.1 the faultCode parameter is
the value of the faultcode element
+ * and the faultString parameter is the value of the faultstring element.
+ *
+ * A SOAPBody may contain at most one SOAPFault child element.
+ *
+ * @param faultCode a QName object giving the fault code to be set; must be one of the
fault codes defined in the version of SOAP specification in use
+ * @param faultString a String giving an explanation of the fault
+ * @param locale a Locale object indicating the native language of the faultString
+ * @return the new SOAPFault object
+ * @throws SOAPException if there is a SOAP error
+ * @since SAAJ 1.3
+ */
+ public abstract SOAPFault addFault(QName faultCode, String faultString, Locale locale)
throws SOAPException;
+
/** Returns the SOAPFault object in this SOAPBody object.
*
* @return the SOAPFault object in this SOAPBody object
@@ -108,4 +158,13 @@
* @return true if a SOAPFault object exists in this SOAPBody object; false
otherwise
*/
public abstract boolean hasFault();
+
+ /**
+ * Creates a new DOM Document and sets the first child of this SOAPBody as it's
document element.
+ * The child SOAPElement is removed as part of the process.
+ * @return the Document representation of the SOAPBody content.
+ * @throws SOAPException if there is not exactly one child SOAPElement of the
SOAPBody.
+ * @since SAAJ 1.3
+ */
+ public Document extractContentAsDocument() throws SOAPException;
}
Modified: trunk/src/main/java/javax/xml/soap/SOAPConnection.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPConnection.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPConnection.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -21,6 +21,8 @@
*/
package javax.xml.soap;
+import org.jboss.util.NotImplementedException;
+
/** A point-to-point connection that a client can use for sending messages directly to a
remote
* party (represented by a URL, for instance).
*
@@ -54,6 +56,19 @@
*/
public abstract SOAPMessage call(SOAPMessage request, Object to) throws
SOAPException;
+ /**
+ * Gets a message from a specific endpoint and blocks until it receives,
+ * @param to an Object that identifies where the request should be sent. Objects of
type java.lang.String and java.net.URL must be supported.
+ * @return the SOAPMessage object that is the response to the get message request
+ * @throws SOAPException if there is a SOAP error
+ * @since SAAJ 1.3
+ */
+ public SOAPMessage get(Object to) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
/** Closes this SOAPConnection object.
*
* @throws SOAPException if there is a SOAP error
Modified: trunk/src/main/java/javax/xml/soap/SOAPConstants.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPConstants.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPConstants.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -21,13 +21,55 @@
*/
package javax.xml.soap;
-/** The definition of constants pertaining to the SOAP 1.1 protocol.
+import javax.xml.namespace.QName;
+
+/** The definition of constants pertaining to the SOAP protocol.
* @author Scott.Stark(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.org
* @version $Revision$
*/
public interface SOAPConstants
{
- public static final String URI_NS_SOAP_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
- public static final String URI_NS_SOAP_ENVELOPE =
"http://schemas.xmlsoap.org/soap/envelope/";
- public static final String URI_SOAP_ACTOR_NEXT =
"http://schemas.xmlsoap.org/soap/actor/next";
+ /** The default protocol: SOAP 1.1 for backwards compatibility. */
+ String DEFAULT_SOAP_PROTOCOL = "SOAP 1.1 Protocol";
+ /** Used to create MessageFactory instances that create SOAPMessages whose concrete
type is based on the Content-Type MIME header passed to the createMessage method. */
+ String DYNAMIC_SOAP_PROTOCOL = "Dynamic Protocol";
+ /** The media type of the Content-Type MIME header in SOAP 1.1. */
+ String SOAP_1_1_CONTENT_TYPE = "text/xml";
+ /** Used to create MessageFactory instances that create SOAPMessages whose behavior
supports the SOAP 1.1 specification */
+ String SOAP_1_1_PROTOCOL = "SOAP 1.1 Protocol";
+ /** The media type of the Content-Type MIME header in SOAP 1.2. */
+ String SOAP_1_2_CONTENT_TYPE = "application/soap+xml";
+ /** Used to create MessageFactory instances that create SOAPMessages whose behavior
supports the SOAP 1.2 specification */
+ String SOAP_1_2_PROTOCOL = "SOAP 1.2 Protocol";
+ /** The default namespace prefix for
http://www.w3.org/2003/05/soap-envelope */
+ String SOAP_ENV_PREFIX = "env";
+ /** The namespace identifier for the SOAP 1.1 envelope. */
+ String URI_NS_SOAP_1_1_ENVELOPE =
"http://schemas.xmlsoap.org/soap/envelope/";
+ /** The namespace identifier for the SOAP 1.2 encoding. */
+ String URI_NS_SOAP_1_2_ENCODING =
"http://www.w3.org/2003/05/soap-encoding";
+ /** The namespace identifier for the SOAP 1.2 envelope. */
+ String URI_NS_SOAP_1_2_ENVELOPE =
"http://www.w3.org/2003/05/soap-envelope";
+ /** The namespace identifier for the SOAP 1.1 encoding. */
+ String URI_NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
+ /** The namespace identifier for the SOAP 1.1 envelope, All SOAPElements in this
namespace are defined by the SOAP 1.1 specification. */
+ String URI_NS_SOAP_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/";
+ /** The URI identifying the next application processing a SOAP request as the intended
role for a SOAP 1.2 header entry (see section 2.2 of part 1 of the SOAP 1.2
specification). */
+ String URI_SOAP_1_2_ROLE_NEXT =
"http://www.w3.org/2003/05/soap-envelope/role/next";
+ /** The URI specifying the role None in SOAP 1.2. */
+ String URI_SOAP_1_2_ROLE_NONE =
"http://www.w3.org/2003/05/soap-envelope/role/none";
+ /** The URI identifying the ultimate receiver of the SOAP 1.2 message. */
+ String URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER =
"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
+ /** The URI identifying the next application processing a SOAP request as the intended
actor for a SOAP 1.1 header entry (see section 4.2.2 of the SOAP 1.1 specification). */
+ String URI_SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
+ /** SOAP 1.2 VersionMismatch Fault */
+ QName SOAP_VERSIONMISMATCH_FAULT = new
QName("http://www.w3.org/2003/05/soap-envelope", "VersionMismatch");
+ /** SOAP 1.2 MustUnderstand Fault */
+ QName SOAP_MUSTUNDERSTAND_FAULT = new
QName("http://www.w3.org/2003/05/soap-envelope", "MustUnderstand");
+ /** SOAP 1.2 DataEncodingUnknown Fault */
+ QName SOAP_DATAENCODINGUNKNOWN_FAULT = new
QName("http://www.w3.org/2003/05/soap-envelope",
"DataEncodingUnknown");
+ /** SOAP 1.2 Sender Fault */
+ QName SOAP_SENDER_FAULT = new
QName("http://www.w3.org/2003/05/soap-envelope", "Sender");
+ /** SOAP 1.2 Receiver Fault */
+ QName SOAP_RECEIVER_FAULT = new
QName("http://www.w3.org/2003/05/soap-envelope", "Receiver");
}
Modified: trunk/src/main/java/javax/xml/soap/SOAPElement.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPElement.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPElement.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -23,6 +23,8 @@
import java.util.Iterator;
+import javax.xml.namespace.QName;
+
import org.w3c.dom.Element;
/** An object representing an element of a SOAP message that is allowed but not
@@ -47,15 +49,35 @@
* @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;
+ SOAPElement addAttribute(Name name, String value) throws SOAPException;
+ /**
+ * Adds an attribute with the specified name and value to this SOAPElement object.
+ * @param qname a QName 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, or it is
invalid to set an attribute with QName qname on this SOAPElement.
+ * @since SAAJ 1.3
+ */
+ SOAPElement addAttribute(QName qname, String value) throws SOAPException;
+
/** Creates a new SOAPElement object initialized with the specified local name and
adds the new element to this SOAPElement object.
*
* @param name 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 name) throws SOAPException;
+ SOAPElement addChildElement(String name) throws SOAPException;
+
+ /**
+ * Creates a new SOAPElement object initialized with the given QName object and adds
the new element to this SOAPElement object.
+ * The namespace, localname and prefix of the new SOAPElement are all taken from the
qname argument.
+ * @param qname a QName 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
+ * @since SAAJ 1.3
+ */
+ SOAPElement addChildElement(QName qname) throws SOAPException;
/** Creates a new SOAPElement object initialized with the specified local name and
prefix and adds the new element to this SOAPElement object.
*
@@ -64,7 +86,7 @@
* @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;
+ 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.
*
@@ -74,7 +96,7 @@
* @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;
+ SOAPElement addChildElement(String localName, String prefix, String uri) throws
SOAPException;
/** Creates a new SOAPElement object initialized with the given Name object and adds
the new element to this SOAPElement object.
*
@@ -82,7 +104,7 @@
* @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;
+ SOAPElement addChildElement(Name name) throws SOAPException;
/** Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is
expected to be created by a SOAPElementFactory.
*
@@ -99,7 +121,7 @@
* @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 child) throws SOAPException;
+ SOAPElement addChildElement(SOAPElement child) throws SOAPException;
/** Adds a namespace declaration with the specified prefix and URI to this SOAPElement
object.
*
@@ -108,7 +130,7 @@
* @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;
+ SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException;
/** Creates a new Text object initialized with the given String and adds it to this
SOAPElement object.
*
@@ -116,8 +138,20 @@
* @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;
+ SOAPElement addTextNode(String text) throws SOAPException;
+ /**
+ * Creates a QName whose namespace URI is the one associated with the parameter,
prefix, in the context of this SOAPElement.
+ * The remaining elements of the new QName are taken directly from the parameters,
localName and prefix.
+ * @param localName a String containing the local part of the name.
+ * @param prefix a String containing the prefix for the name.
+ * @return a QName with the specified localName and prefix, and with a namespace that
is associated with the prefix in the context of this SOAPElement.
+ * This namespace will be the same as the one that would be returned by
getNamespaceURI(String) if it were given prefix as it's parameter.
+ * @throws SOAPException if the QName cannot be created.
+ * @since SAAJ 1.3
+ */
+ QName createQName(String localName, String prefix) throws SOAPException;
+
/** Returns an Iterator over all of the attribute Name objects in this SOAPElement
object.
*
* The iterator can be used to get the attribute names, which can then be passed to
the method getAttributeValue to
@@ -125,15 +159,31 @@
*
* @return an iterator over the names of the attributes
*/
- public abstract Iterator getAllAttributes();
+ Iterator getAllAttributes();
+ /**
+ * Returns an Iterator over all of the attributes in this SOAPElement as QName
objects.
+ * The iterator can be used to get the attribute QName, which can then be passed to
the method getAttributeValue to retrieve the value of each attribute.
+ * @return an iterator over the QNames of the attributes
+ * @since SAAJ 1.3
+ */
+ Iterator getAllAttributesAsQNames();
+
/** 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);
+ String getAttributeValue(Name name);
+ /**
+ * Returns the value of the attribute with the specified qname.
+ * @param qname a QName object with the qname of the attribute
+ * @return a String giving the value of the specified attribute, Null if there is no
such attribute
+ * @since SAAJ 1.3
+ */
+ String getAttributeValue(QName qname);
+
/** Returns an Iterator over all the immediate child Nodes of this element.
*
* This includes javax.xml.soap.Text objects as well as SOAPElement objects.
@@ -145,7 +195,7 @@
*
* @return an iterator with the content of this SOAPElement object
*/
- public abstract Iterator getChildElements();
+ Iterator getChildElements();
/** Returns an Iterator over all the immediate child Nodes of this element with the
specified name.
*
@@ -159,19 +209,54 @@
* @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);
+ Iterator getChildElements(Name name);
+ /**
+ * Returns an Iterator over all the immediate child Nodes of this element with the
specified qname.
+ * All of these children will be SOAPElement nodes.
+ *
+ * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes
to be replaced by
+ * SOAPElement, SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as
appropriate for the type of this parent node.
+ * As a result the calling application must treat any existing references to these
child nodes that have been obtained through
+ * DOM APIs as invalid and either discard them or refresh them with the values
returned by this Iterator.
+ * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap
for more details.
+ * @param qname a QName object with the qname of the child elements to be returned
+ * @return an Iterator object over all the elements in this SOAPElement object with
the specified qname
+ * @since SAAJ 1.3
+ */
+ Iterator getChildElements(QName qname);
+
/** Returns the name of this SOAPElement object.
*
* @return a Name object with the name of this SOAPElement object
*/
- public abstract Name getElementName();
+ Name getElementName();
+ /**
+ * Returns the qname of this SOAPElement object.
+ * @return a QName object with the qname of this SOAPElement object
+ * @since SAAJ 1.3
+ */
+ QName getElementQName();
+
+ /**
+ * Changes the name of this Element to newName if possible. SOAP Defined elements such
as SOAPEnvelope, SOAPHeader, SOAPBody etc. cannot
+ * have their names changed using this method. Any attempt to do so will result in a
SOAPException being thrown.
+ *
+ * Callers should not rely on the element instance being renamed as is.
+ * Implementations could end up copying the content of the SOAPElement to a renamed
instance.
+ * @param qname the new name for the Element.
+ * @return The renamed Node
+ * @throws SOAPException if changing the name of this Element is not allowed.
+ * @since SAAJ 1.3
+ */
+ SOAPElement setElementQName(QName qname) throws SOAPException;
+
/** Returns the encoding style for this SOAPElement object.
*
* @return a String giving the encoding style
*/
- public abstract String getEncodingStyle();
+ String getEncodingStyle();
/** Returns an Iterator over the namespace prefix Strings declared by this element.
*
@@ -179,14 +264,14 @@
*
* @return an iterator over the namespace prefixes in this SOAPElement object
*/
- public abstract Iterator getNamespacePrefixes();
+ Iterator getNamespacePrefixes();
/** 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);
+ String getNamespaceURI(String prefix);
/** Returns an Iterator over the namespace prefix Strings visible to this element.
*
@@ -194,35 +279,43 @@
*
* @return an iterator over the namespace prefixes are within scope of this
SOAPElement object
*/
- public abstract Iterator getVisibleNamespacePrefixes();
+ Iterator getVisibleNamespacePrefixes();
/** 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);
+ boolean removeAttribute(Name name);
+ /**
+ * Removes the attribute with the specified qname.
+ * @param qname the QName object with the qname of the attribute to be removed
+ * @return true if the attribute was removed successfully; false if it was not
+ * @since SAAJ 1.3
+ */
+ boolean removeAttribute(QName qname);
+
/** Detaches all children of this SOAPElement.
*
* This method is useful for rolling back the construction of partially completed
SOAPHeaders and SOAPBodys in
* preparation for sending a fault when an error condition is detected.
* It is also useful for recycling portions of a document within a SOAP message.
*/
- public abstract void removeContents();
+ void removeContents();
/** 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);
+ boolean removeNamespaceDeclaration(String prefix);
/** 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.
*/
- public abstract void setEncodingStyle(String encodingStyle) throws SOAPException;
+ void setEncodingStyle(String encodingStyle) throws SOAPException;
}
Modified: trunk/src/main/java/javax/xml/soap/SOAPFactory.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -26,8 +26,10 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
-import org.jboss.logging.Logger;
+import javax.xml.namespace.QName;
+import org.jboss.util.NotImplementedException;
+
/** SOAPFactory is a factory for creating various objects that exist in the SOAP XML
tree.
*
* SOAPFactory can be used to create XML fragments that will eventually end up in the
SOAP part.
@@ -41,13 +43,16 @@
*/
public abstract class SOAPFactory
{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPFactory.class);
-
private static final String DEFAULT_SOAP_FACTORY =
"org.jboss.ws.core.soap.SOAPFactoryImpl";
- private static final String[] alternativeFactories = new String[] {
"org.jboss.axis.soap.SOAPFactoryImpl" };
- /** Creates a new instance of SOAPFactory.
+ /**
+ * Creates a new SOAPFactory object that is an instance of the default implementation
(SOAP 1.1),
+ * This method uses the following ordered lookup procedure to determine the
SOAPFactory implementation class to load:
+ *
+ * Use the javax.xml.soap.SOAPFactory system property.
+ * Use the properties file "lib/jaxm.properties" in the JRE directory.
This configuration file is in standard java.util.Properties format and contains the fully
qualified name of the implementation class with the key being the system property defined
above.
+ * Use the Services API (as detailed in the JAR specification), if available, to
determine the classname. The Services API will look for a classname in the file
META-INF/services/javax.xml.soap.SOAPFactory in jars available to the runtime.
+ * Use the SAAJMetaFactory instance to locate the SOAPFactory implementation class.
*
* @return a new instance of a SOAPFactory
* @throws SOAPException if there was an error creating the default SOAPFactory
@@ -57,43 +62,36 @@
PrivilegedAction action = new PropertyAccessAction(SOAPFactory.class.getName(),
DEFAULT_SOAP_FACTORY);
String factoryName = (String)AccessController.doPrivileged(action);
+ //TODO: SAAJ 1.3 (implement the lookup)
+
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try
{
- try
- {
- Class factoryClass = loader.loadClass(factoryName);
- return (SOAPFactory)factoryClass.newInstance();
- }
- catch (ClassNotFoundException e)
- {
- // Throw the exception if the user asked for a specific factory
- if (factoryName.equals(DEFAULT_SOAP_FACTORY) == false)
- throw e;
-
- for (int i = 0; i < alternativeFactories.length; i++)
- {
- factoryName = alternativeFactories[i];
- try
- {
- Class factoryClass = loader.loadClass(factoryName);
- return (SOAPFactory)factoryClass.newInstance();
- }
- catch (ClassNotFoundException e1)
- {
- log.debug("Cannot load factory: " + factoryName);
- }
- }
- }
+ Class factoryClass = loader.loadClass(factoryName);
+ return (SOAPFactory)factoryClass.newInstance();
}
catch (Throwable t)
{
throw new SOAPException("Failed to create SOAPFactory: " +
factoryName, t);
}
+ }
- throw new SOAPException("Cannot find SOAPFactory implementation");
+
+ /**
+ * Creates a new SOAPFactory object that is an instance of the specified
implementation, this method uses the SAAJMetaFactory
+ * to locate the implementation class and create the SOAPFactory instance.
+ *
+ * @param protocol a string constant representing the class of the specified message
factory implementation.
+ * May be either DYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL (which is the same
as) SOAP_1_1_PROTOCOL, or SOAP_1_2_PROTOCOL.
+ * @throws SOAPException if there was an error creating the specified SOAPFactory
+ * @since SAAJ 1.3
+ */
+ public static SOAPFactory newInstance(String protocol) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
}
-
+
/** Creates a new Detail object which serves as a container for DetailEntry objects.
*
* This factory method creates Detail objects for use in situations where it is not
practical to use the SOAPFault abstraction.
@@ -103,6 +101,22 @@
*/
public abstract Detail createDetail() throws SOAPException;
+ /**
+ * Creates a SOAPElement object from an existing DOM Element. If the DOM Element that
is passed in as an argument is already a
+ * SOAPElement then this method must return it unmodified without any further work.
Otherwise, a new SOAPElement is created and
+ * a deep copy is made of the domElement argument. The concrete type of the return
value will depend on the name of the domElement
+ * argument. If any part of the tree rooted in domElement violates SOAP rules, a
SOAPException will be thrown.
+ * @param domElement the Element to be copied.
+ * @return a new SOAPElement that is a copy of domElement.
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ * @since SAAJ 1.3
+ */
+ public SOAPElement createElement(org.w3c.dom.Element domElement) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
/** Create a SOAPElement object initialized with the given local name.
*
* @param localName a String giving the local name for the new element
@@ -129,6 +143,40 @@
*/
public abstract SOAPElement createElement(Name name) throws SOAPException;
+ /**
+ * Creates a SOAPElement object initialized with the given QName object.
+ * The concrete type of the return value will depend on the name given to the new
SOAPElement.
+ * For instance, a new SOAPElement with the name
"{http://www.w3.org/2003/05/soap-envelope}Envelope" would
+ * cause a SOAPEnvelope that supports SOAP 1.2 behavior to be created.
+ * @param qname a QName 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
+ * @since SAAJ 1.3
+ */
+ public SOAPElement createElement(QName qname) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ /**
+ * Creates a new SOAPFault object initialized with the given reasonText and
faultCode
+ * @param reasonText the ReasonText/FaultString for the fault
+ * @param faultCode the FaultCode for the fault
+ * @return a SOAPFault object
+ * @throws SOAPException if there is a SOAP error
+ * @since SAAJ 1.3
+ */
+ public abstract SOAPFault createFault(String reasonText, QName faultCode) throws
SOAPException;
+
+ /**
+ * Creates a new default SOAPFault object
+ * @return a SOAPFault object
+ * @throws SOAPException if there is a SOAP error
+ * @since SAAJ 1.3
+ */
+ public abstract SOAPFault createFault() throws SOAPException;
+
/** Creates a new Name object initialized with the given local name.
*
* This factory method creates Name objects for use in situations where it is not
practical to use the
Modified: trunk/src/main/java/javax/xml/soap/SOAPFault.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPFault.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPFault.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -21,23 +21,22 @@
*/
package javax.xml.soap;
+import java.util.Iterator;
import java.util.Locale;
+import javax.xml.namespace.QName;
+
/** 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.
+ * Depending on the protocol specified while creating the MessageFactory instance, a
+ * SOAPFault has sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification.
*
* @author Scott.Stark(a)jboss.org
+ * @author Thomas.Diesler(a)jboss.org
* @version $Revision$
*/
public interface SOAPFault extends SOAPBodyElement
@@ -50,28 +49,58 @@
* @return the new Detail object
* @throws SOAPException if this SOAPFault object already contains a valid Detail
object
*/
- public Detail addDetail() throws SOAPException;
+ Detail addDetail() throws SOAPException;
/**
+ * Appends or replaces a Reason Text item containing the specified text message and an
xml:lang derived from locale.
+ * If a Reason Text item with this xml:lang already exists its text value will be
replaced with text.
+ * The locale parameter should not be null
+ *
+ * Code sample:
+ *
+ * SOAPFault fault = ...;
+ * fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);
+ *
+ * @param text reason message string
+ * @param locale Locale object representing the locale of the message
+ * @throws SOAPException if there was an error in adding the Reason text or the locale
passed was null.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Reason.
+ * @since SAAJ 1.3
+ */
+ void addFaultReasonText(String text, Locale locale) throws SOAPException;
+
+ /**
+ * Adds a Subcode to the end of the sequence of Subcodes contained by this SOAPFault.
+ * Subcodes, which were introduced in SOAP 1.2, are represented by a recursive
sequence of
+ * subelements rooted in the mandatory Code subelement of a SOAP Fault.
+ *
+ * @param subcode a QName containing the Value of the Subcode
+ * @throws SOAPException if there was an error in setting the Subcode
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Subcode.
+ * @since SAAJ 1.3
+ */
+ void appendFaultSubcode(javax.xml.namespace.QName subcode) throws SOAPException;
+
+ /**
* Returns the optional 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 Detail getDetail();
+ Detail getDetail();
/**
* Gets the fault actor for this SOAPFault object.
* @return a String giving the actor in the message path that caused this SOAPFault
object
*/
- public String getFaultActor();
+ String getFaultActor();
/**
* Gets the fault code for this SOAPFault object.
* @return a String with the fault code
*/
- public String getFaultCode();
+ String getFaultCode();
/**
* Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name
object.
@@ -84,21 +113,112 @@
*
* @return a Name representing the faultcode
*/
- public Name getFaultCodeAsName();
+ Name getFaultCodeAsName();
/**
+ * Gets the fault code for this SOAPFault object as a QName object.
+ * @return a QName representing the faultcode
+ * @since SAAJ 1.3
+ */
+ QName getFaultCodeAsQName();
+
+ /**
+ * Returns the optional Node element value for this SOAPFault object. The Node element
is optional in SOAP 1.2.
+ * @return Content of the env:Fault/env:Node element as a String or null if none
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Node.
+ * @since SAAJ 1.3
+ */
+ String getFaultNode();
+
+ /**
+ * Returns an Iterator over a distinct sequence of Locales for which there are
associated Reason Text items.
+ * Any of these Locales can be used in a call to getFaultReasonText in order to obtain
a localized version of the Reason Text string.
+ * @return an Iterator over a sequence of Locale objects for which there are
associated Reason Text items.
+ * @throws SOAPException if there was an error in retrieving the fault Reason
locales.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Reason.
+ * @since SAAJ 1.3
+ */
+ Iterator getFaultReasonLocales() throws SOAPException;
+
+ /**
+ * Returns an Iterator over a sequence of String objects containing all of the Reason
Text items for this SOAPFault.
+ * @return an Iterator over env:Fault/env:Reason/env:Text items.
+ * @throws SOAPException if there was an error in retrieving the fault Reason texts.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Reason.
+ * @since SAAJ 1.3
+ */
+ Iterator getFaultReasonTexts() throws SOAPException;
+
+ /**
+ * Returns the Reason Text associated with the given Locale. If more than one such
Reason Text exists the first matching Text is returned
+ * @param locale the Locale for which a localized Reason Text is desired
+ * @return the Reason Text associated with locale
+ * @throws SOAPException if there was an error in retrieving the fault Reason text for
the specified locale .
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Reason.
+ * @since SAAJ 1.3
+ */
+ String getFaultReasonText(Locale locale) throws SOAPException;
+
+ /**
+ * Creates or replaces any existing Node element value for this SOAPFault object. The
Node element is optional in SOAP 1.2.
+ * @throws SOAPException f there was an error in setting the Node for this SOAPFault
object.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Node.
+ * @since SAAJ 1.3
+ */
+ void setFaultNode(String uri) throws SOAPException;
+
+ /**
+ * Returns the optional Role element value for this SOAPFault object. The Role element
is optional in SOAP 1.2.
+ * @return Content of the env:Fault/env:Role element as a String or null if none
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Role.
+ * @since SAAJ 1.3
+ */
+ String getFaultRole();
+
+ /**
+ * Creates or replaces any existing Role element value for this SOAPFault object. The
Role element is optional in SOAP 1.2.
+ * @throws SOAPException f there was an error in setting the Role for this SOAPFault
object.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Role.
+ * @since SAAJ 1.3
+ */
+ void setFaultRole(String uri) throws SOAPException;
+ /**
* Gets the fault string for this SOAPFault object.
* @return a String giving an explanation of the fault
*/
- public String getFaultString();
+ String getFaultString();
/**
* Gets the locale of the fault string for this SOAPFault object.
* @return a Locale object indicating the native language of the fault string or null
if no locale was specified
*/
- public Locale getFaultStringLocale();
+ Locale getFaultStringLocale();
/**
+ * Gets the Subcodes for this SOAPFault as an iterator over QNames.
+ * @return an Iterator that accesses a sequence of QNames. This Iterator should not
support the optional remove method.
+ * The order in which the Subcodes are returned reflects the hierarchy of Subcodes
present in the fault from top to bottom.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Subcode.
+ * @since SAAJ 1.3
+ */
+ Iterator getFaultSubcodes();
+
+ /**
+ * Removes any Subcodes that may be contained by this SOAPFault. Subsequent calls to
getFaultSubcodes will return an empty
+ * iterator until a call to appendFaultSubcode is made.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Subcode.
+ * @since SAAJ 1.3
+ */
+ void removeAllFaultSubcodes();
+
+ /**
+ * Returns true if this SOAPFault has a Detail subelement and false otherwise.
Equivalent to (getDetail()!=null).
+ * @return true if this SOAPFault has a Detail subelement and false otherwise.
+ * @since SAAJ 1.3
+ */
+ boolean hasDetail();
+
+ /**
* 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.
@@ -106,7 +226,7 @@
* @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 void setFaultActor(String faultActor) throws SOAPException;
+ void setFaultActor(String faultActor) throws SOAPException;
/**
* Sets this SOAPFault object with the give fault code.
@@ -119,7 +239,7 @@
* It must be of the form "prefix:localName" where the prefix has been
defined in a namespace declaration.
* @throws SOAPException if there was an error in adding the faultCode to the
underlying XML tree.
*/
- public void setFaultCode(String faultCode) throws SOAPException;
+ void setFaultCode(String faultCode) throws SOAPException;
/**
* Sets this SOAPFault object with the given fault code.
@@ -141,7 +261,7 @@
* @param faultCodeQName a Name object giving the fault code to be set. It must be
namespace qualified.
* @throws SOAPException if there was an error in adding the faultcode element to the
underlying XML tree.
*/
- public void setFaultCode(Name faultCodeQName) throws SOAPException;
+ void setFaultCode(Name faultCodeQName) throws SOAPException;
/**
* Sets the fault string for this SOAPFault object to the given string.
@@ -149,7 +269,7 @@
* @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.
*/
- public void setFaultString(String faultString) throws SOAPException;
+ void setFaultString(String faultString) throws SOAPException;
/**
* Sets the fault string for this SOAPFault object to the given string and localized
to the given locale.
@@ -158,5 +278,5 @@
* @param locale a Locale object indicating the native language of the faultString
* @throws SOAPException
*/
- public void setFaultString(String faultString, Locale locale) throws SOAPException;
+ void setFaultString(String faultString, Locale locale) throws SOAPException;
}
Modified: trunk/src/main/java/javax/xml/soap/SOAPHeader.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPHeader.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPHeader.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -23,6 +23,8 @@
import java.util.Iterator;
+import javax.xml.namespace.QName;
+
/**
* A representation of the SOAP header element. A SOAP header element consists
* of XML data that affects the way the application-specific content is
@@ -67,6 +69,60 @@
public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException;
/**
+ * Creates a new SOAPHeaderElement object initialized with the specified qname and
adds it to this SOAPHeader object.
+ * @param qname a QName object with the qname of the new SOAPHeaderElement object
+ * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader
object
+ * @throws SOAPException if a SOAP error occurs
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addHeaderElement(QName qname) throws SOAPException;
+
+ /**
+ * Creates a new NotUnderstood SOAPHeaderElement object initialized with the specified
name and adds it to this SOAPHeader object.
+ * This operation is supported only by SOAP 1.2.
+ *
+ * @param qname a QName object with the name of the SOAPHeaderElement object that was
not understood.
+ * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader
object
+ * @throws SOAPException if a SOAP error occurs.
+ * @throws UnsupportedOperationException if this is a SOAP 1.1 Header.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws
SOAPException;
+
+ /**
+ * Creates a new Upgrade SOAPHeaderElement object initialized with the specified List
of supported SOAP URIs
+ * and adds it to this SOAPHeader object. This operation is supported on both SOAP 1.1
and SOAP 1.2 header.
+ *
+ * @param soapURIs an Iterator object with the URIs of SOAP versions supported.
+ * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader
object
+ * @throws SOAPException if a SOAP error occurs.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addUpgradeHeaderElement(Iterator soapURIs) throws
SOAPException;
+
+ /**
+ * Creates a new Upgrade SOAPHeaderElement object initialized with the specified array
of supported SOAP URIs
+ * and adds it to this SOAPHeader object. This operation is supported on both SOAP 1.1
and SOAP 1.2 header.
+ *
+ * @param soapURIs an array of the URIs of SOAP versions supported.
+ * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader
object
+ * @throws SOAPException if a SOAP error occurs.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addUpgradeHeaderElement(String[] soapURIs) throws
SOAPException;
+
+ /**
+ * Creates a new Upgrade SOAPHeaderElement object initialized with the specified
supported SOAP URI and adds it to this SOAPHeader object.
+ * This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
+ *
+ * @param soapURI the URI of SOAP the version that is supported.
+ * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader
object
+ * @throws SOAPException if a SOAP error occurs.
+ * @since SAAJ 1.3
+ */
+ public SOAPHeaderElement addUpgradeHeaderElement(String soapURI) throws
SOAPException;
+
+ /**
* Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object.
*
* @return an Iterator object over all the SOAPHeaderElement objects contained by this
SOAPHeader
Modified: trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -44,6 +44,36 @@
*/
public boolean getMustUnderstand();
+ /**
+ * Returns the boolean value of the relay attribute for this SOAPHeaderElement
+ * @return true if the relay attribute is turned on; false otherwise
+ * @throws UnsupportedOperationException - if this message does not support the SOAP
1.2 concept of Relay attribute.
+ * @since SAAJ 1.3
+ */
+ public boolean getRelay();
+
+ /**
+ * Sets the relay attribute for this SOAPHeaderElement to be either true or false.
+ *
+ * The SOAP relay attribute is set to true to indicate that the SOAP header block must
be relayed by any node that is
+ * targeted by the header block but not actually process it. This attribute is ignored
on header blocks whose mustUnderstand
+ * attribute is set to true or that are targeted at the ultimate reciever (which is
the default).
+ * The default value of this attribute is false.
+ * @param relay the new value of the relay attribute
+ * @throws SOAPException if there is a problem in setting the relay attribute.
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Relay attribute.
+ * @since SAAJ 1.3
+ */
+ public void setRelay(boolean relay) throws SOAPException;
+
+ /**
+ * Returns the value of the Role attribute of this SOAPHeaderElement.
+ * @return a String giving the URI of the Role
+ * @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Role.
+ * @since SAAJ 1.3
+ */
+ public boolean getRole();
+
/** Sets the actor associated with this SOAPHeaderElement object to the specified
actor.
* The default value of an actor is: SOAPConstants.URI_SOAP_ACTOR_NEXT
*
Modified: trunk/src/main/java/javax/xml/soap/SOAPMessage.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPMessage.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPMessage.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -237,6 +237,14 @@
public abstract void removeAllAttachments();
/**
+ * Removes all the AttachmentPart objects that have header entries that match the
specified headers.
+ * Note that the removed attachment could have headers in addition to those
specified.
+ * @param headers a MimeHeaders object containing the MIME headers for which to
search
+ * @since SAAJ 1.3
+ */
+ public abstract void removeAttachments(MimeHeaders headers);
+
+ /**
* 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
*/
@@ -249,6 +257,21 @@
public abstract Iterator getAttachments();
/**
+ * Returns an AttachmentPart object that is associated with an attachment that is
referenced by this SOAPElement or null
+ * if no such attachment exists. References can be made via an href attribute as
described in SOAP Messages with Attachments,
+ * or via a single Text child node containing a URI as described in the WS-I
Attachments Profile 1.0 for elements of
+ * schema type ref:swaRef(ref:swaRef). These two mechanisms must be supported.
+ * The support for references via href attribute also implies that this method should
also be supported on an element that
+ * is an xop:Include element ( XOP). other reference mechanisms may be supported by
individual implementations of this standard.
+ * Contact your vendor for details.
+ * @param element The SOAPElement containing the reference to an Attachment
+ * @return the referenced AttachmentPart or null if no such AttachmentPart exists or
no reference can be found in this SOAPElement.
+ * @throws SOAPException if there is an error in the attempt to access the attachment
+ * @since SAAJ 1.3
+ */
+ public abstract AttachmentPart getAttachment(SOAPElement element) throws
SOAPException;
+
+ /**
* 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 mimeheaders a MimeHeaders object containing the MIME headers for which to
search
Modified: trunk/src/main/java/javax/xml/soap/SOAPPart.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPPart.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/javax/xml/soap/SOAPPart.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -55,7 +55,7 @@
* @author Scott.Stark(a)jboss.org
* @version $Revision$
*/
-public abstract class SOAPPart implements Document
+public abstract class SOAPPart implements Document, Node
{
public SOAPPart()
{
Modified: trunk/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/Constants.java 2006-12-13 01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/Constants.java 2006-12-13 13:13:27 UTC (rev 1637)
@@ -24,6 +24,7 @@
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
+import javax.xml.soap.SOAPConstants;
import org.jboss.ws.core.soap.NameImpl;
@@ -54,7 +55,7 @@
/** SOAP-1.1 namespace
http://schemas.xmlsoap.org/wsdl/soap/ */
static final String NS_SOAP11 = "http://schemas.xmlsoap.org/wsdl/soap/";
/** SOAP-1.1 envelope namespace
http://schemas.xmlsoap.org/soap/envelope/ */
- static final String NS_SOAP11_ENV =
"http://schemas.xmlsoap.org/soap/envelope/";
+ static final String NS_SOAP11_ENV = SOAPConstants.URI_NS_SOAP_ENVELOPE;
/** SOAP-1.2 namespace
http://schemas.xmlsoap.org/wsdl/soap12/ */
static final String NS_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/";
/** SOAP-1.2 envelope namespace
http://www.w3.org/2003/05/soap-envelope */
@@ -63,8 +64,6 @@
static final String NS_SWA_MIME = "http://schemas.xmlsoap.org/wsdl/mime/";
/** Default namespace for WSDL-1.1
http://schemas.xmlsoap.org/wsdl/ */
static final String NS_WSDL11 = "http://schemas.xmlsoap.org/wsdl/";
- /** Default namespace for WSDL-2.0
http://www.w3.org/TR/wsdl20 */
- static final String NS_WSDL20 = "http://www.w3.org/2003/11/wsdl";
/** The namespace for the MTOM content type attribute. */
static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime";
/** The namespace for XOP. */
@@ -76,9 +75,9 @@
static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
/** SOAP-1.1 encoding URI */
- static final String URI_SOAP11_ENC =
"http://schemas.xmlsoap.org/soap/encoding/";
+ static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING;
/** SOAP-1.2 encoding URI */
- static final String URI_SOAP12_ENC =
"http://www.w3.org/2003/05/soap-encoding";
+ static final String URI_SOAP12_ENC = SOAPConstants.URI_NS_SOAP_1_2_ENCODING;
/** Literal encoding URI */
static final String URI_LITERAL_ENC = "";
/** WSDL 2.0 Encoding Rules */
@@ -124,11 +123,6 @@
static final Name SOAP11_BODY = new NameImpl("Body", PREFIX_ENV,
NS_SOAP11_ENV);
static final Name SOAP11_FAULT = new NameImpl("Fault", PREFIX_ENV,
NS_SOAP11_ENV);
- /** SOAP-1.2 roles */
- static final String URI_SOAP12_ROLE_NONE =
"http://www.w3.org/2003/05/soap-envelope/role/none";
- static final String URI_SOAP12_ROLE_NEXT =
"http://www.w3.org/2003/05/soap-envelope/role/next";
- static final String URI_SOAP12_ROLE_ULTIMATE_RECEIVER =
"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
-
/** The default RPC return parameter name */
static final String DEFAULT_RPC_RETURN_NAME = "result"; // FIXME: According
to JSR-181 this should be 'return'
Modified: trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-13
01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2006-12-13
13:13:27 UTC (rev 1637)
@@ -27,13 +27,13 @@
import java.util.List;
import java.util.Set;
+import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP12Binding;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
@@ -71,8 +71,8 @@
// 10.3 Conformance (Default role visibility): An implementation MUST include the
required next and ultimate
// receiver roles in the Set returned from SOAPBinding.getRoles.
Set<String> soap12Roles = new HashSet<String>(delegate.getRoles());
- soap12Roles.add(Constants.URI_SOAP12_ROLE_NEXT);
- soap12Roles.add(Constants.URI_SOAP12_ROLE_ULTIMATE_RECEIVER);
+ soap12Roles.add(SOAPConstants.URI_SOAP_1_2_ROLE_NEXT);
+ soap12Roles.add(SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER);
return soap12Roles;
}
@@ -82,7 +82,7 @@
// attempts to configure the binding to play the none role via
SOAPBinding.setRoles.
for (String role : roles)
{
- if (role.equals(Constants.URI_SOAP12_ROLE_NONE))
+ if (role.equals(SOAPConstants.URI_SOAP_1_2_ROLE_NONE))
throw new WebServiceException("Attempt to configure the binding to play
the none role");
}
delegate.setRoles(roles);
Modified: trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java 2006-12-13 01:30:26
UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/DetailEntryImpl.java 2006-12-13 13:13:27
UTC (rev 1637)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.core.soap;
+import javax.xml.namespace.QName;
import javax.xml.soap.DetailEntry;
import javax.xml.soap.Name;
@@ -38,6 +39,11 @@
super(name);
}
+ public DetailEntryImpl(QName qname)
+ {
+ super(qname);
+ }
+
public DetailEntryImpl(SOAPElementImpl soapElement)
{
super(soapElement);
Modified: trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java 2006-12-13 01:30:26 UTC
(rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/DetailImpl.java 2006-12-13 13:13:27 UTC
(rev 1637)
@@ -23,6 +23,7 @@
import java.util.Iterator;
+import javax.xml.namespace.QName;
import javax.xml.soap.Detail;
import javax.xml.soap.DetailEntry;
import javax.xml.soap.Name;
@@ -53,6 +54,13 @@
return detailEntry;
}
+ public DetailEntry addDetailEntry(QName qname) throws SOAPException
+ {
+ DetailEntryImpl detailEntry = new DetailEntryImpl(qname);
+ addChildElement(detailEntry);
+ return detailEntry;
+ }
+
public Iterator getDetailEntries()
{
return getChildElements();
Modified: trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -104,30 +104,6 @@
}
}
- /** Get the QName of this Node */
- protected QName getQName()
- {
- String nsURI = getNamespaceURI();
- String localPart = getLocalName();
- String prefix = getPrefix();
-
- QName qname;
- if (nsURI != null && prefix != null)
- {
- qname = new QName(nsURI, localPart, prefix);
- }
- else if (nsURI != null)
- {
- qname = new QName(nsURI, localPart);
- }
- else
- {
- qname = new QName(localPart);
- }
-
- return qname;
- }
-
// javax.xml.soap.Node
*********************************************************************************************
/**
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2006-12-13 01:30:26
UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2006-12-13 13:13:27
UTC (rev 1637)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.core.soap;
+import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBodyElement;
@@ -39,8 +40,14 @@
super(name);
}
+ public SOAPBodyElementDoc(QName qname)
+ {
+ super(qname);
+ }
+
public SOAPBodyElementDoc(SOAPElementImpl element)
{
super(element);
}
+
}
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2006-12-13 01:30:26 UTC
(rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2006-12-13 13:13:27 UTC
(rev 1637)
@@ -32,6 +32,7 @@
import java.util.Iterator;
import java.util.Locale;
+import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
@@ -46,6 +47,7 @@
import javax.xml.transform.stream.StreamSource;
import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
@@ -127,6 +129,14 @@
return (SOAPBodyElement)addChildElement(child);
}
+ public SOAPBodyElement addBodyElement(QName qname) throws SOAPException
+ {
+ log.trace("addBodyElement: " + qname);
+ expandToDOM();
+ SOAPBodyElement child = new SOAPBodyElementDoc(qname);
+ return (SOAPBodyElement)addChildElement(child);
+ }
+
public SOAPBodyElement addDocument(Document doc) throws SOAPException
{
log.trace("addDocument");
@@ -161,6 +171,20 @@
return soapFault;
}
+ public SOAPFault addFault(QName faultCode, String faultString) throws SOAPException
+ {
+ log.trace("addFault");
+ expandToDOM();
+ if (hasFault())
+ throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
+
+ SOAPFaultImpl soapFault = new SOAPFaultImpl(getNamespaceURI());
+ soapFault = (SOAPFaultImpl)addChildElement(soapFault);
+ soapFault.setFaultCode(faultCode);
+ soapFault.setFaultString(faultString);
+ return soapFault;
+ }
+
public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws
SOAPException
{
log.trace("addFault");
@@ -175,6 +199,20 @@
return soapFault;
}
+ public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws
SOAPException
+ {
+ log.trace("addFault");
+ expandToDOM();
+ if (hasFault())
+ throw new SOAPException("A SOAPBody may contain at most one SOAPFault child
element");
+
+ SOAPFaultImpl soapFault = new SOAPFaultImpl(getNamespaceURI());
+ soapFault.setFaultCode(faultCode);
+ soapFault.setFaultString(faultString, locale);
+ addChildElement(soapFault);
+ return soapFault;
+ }
+
public SOAPFault getFault()
{
log.trace("getFault");
@@ -403,4 +441,10 @@
super.writeElementContent(writer);
}
}
+
+ public Document extractContentAsDocument() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-13 01:30:26
UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2006-12-13 13:13:27
UTC (rev 1637)
@@ -110,6 +110,12 @@
isDOMValid = true;
}
+ public SOAPContentElement(QName qname)
+ {
+ super(qname);
+ isDOMValid = true;
+ }
+
public SOAPContentElement(SOAPElementImpl element)
{
super(element);
@@ -174,7 +180,7 @@
TypeMappingImpl typeMapping = serContext.getTypeMapping();
- QName xmlName = getQName();
+ QName xmlName = getElementQName();
try
{
SerializerSupport ser;
@@ -254,7 +260,7 @@
String strContent = getXMLFragment();
- Object obj = des.deserialize(getQName(), xmlType, strContent, serContext);
+ Object obj = des.deserialize(getElementQName(), xmlType, strContent,
serContext);
if (obj != null)
{
Class objType = obj.getClass();
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2006-12-13 01:30:26
UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2006-12-13 13:13:27
UTC (rev 1637)
@@ -94,6 +94,12 @@
this(name.getLocalName(), name.getPrefix(), name.getURI());
}
+ /** Called by SOAPFactory */
+ public SOAPElementImpl(QName qname)
+ {
+ this(qname.getLocalPart(), qname.getPrefix(), qname.getNamespaceURI());
+ }
+
/** Copy constructor for converting SOAPElement types
*/
protected SOAPElementImpl(SOAPElementImpl element)
@@ -115,6 +121,35 @@
// javax.xml.soap.SOAPElement
*************************************************************************************
+ public QName getElementQName()
+ {
+ String nsURI = getNamespaceURI();
+ String localPart = getLocalName();
+ String prefix = getPrefix();
+
+ QName qname;
+ if (nsURI != null && prefix != null)
+ {
+ qname = new QName(nsURI, localPart, prefix);
+ }
+ else if (nsURI != null)
+ {
+ qname = new QName(nsURI, localPart);
+ }
+ else
+ {
+ qname = new QName(localPart);
+ }
+
+ return qname;
+ }
+
+ public SOAPElement setElementQName(QName qname) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
/**
* Adds an attribute with the specified name and value to this SOAPElement object.
*
@@ -137,6 +172,11 @@
return this;
}
+ public SOAPElement addAttribute(QName qname, String value) throws SOAPException
+ {
+ return addAttribute(new NameImpl(qname), value);
+ }
+
/**
* Creates a new SOAPElement object initialized with the specified local name and adds
the new element to this SOAPElement object.
*
@@ -200,6 +240,11 @@
return soapElement;
}
+ public SOAPElement addChildElement(QName qname) throws SOAPException
+ {
+ return addChildElement(new NameImpl(qname));
+ }
+
/**
* Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is
expected to be created by a
* SOAPElementFactory.
@@ -316,6 +361,33 @@
return list.iterator();
}
+ public Iterator getAllAttributesAsQNames()
+ {
+ ArrayList list = new ArrayList();
+ NamedNodeMap nnm = getAttributes();
+ for (int i = 0; i < nnm.getLength(); i++)
+ {
+ org.w3c.dom.Node node = (org.w3c.dom.Node)nnm.item(i);
+ String local = node.getLocalName();
+ String prefix = node.getPrefix();
+ String uri = node.getNamespaceURI();
+ if ("xmlns".equals(prefix) == false)
+ {
+ QName qname;
+ if (uri != null && uri.length() > 0)
+ {
+ qname = new QName(uri, local, prefix);
+ }
+ else
+ {
+ qname = new QName(local);
+ }
+ list.add(qname);
+ }
+ }
+ return list.iterator();
+ }
+
/**
* Returns the value of the attribute with the specified name.
*
@@ -328,6 +400,11 @@
return (attr != null ? attr.getValue() : null);
}
+ public String getAttributeValue(QName qname)
+ {
+ return getAttributeValue(new NameImpl(qname));
+ }
+
private Attr getAttributeNode(Name name)
{
Attr attr = null;
@@ -340,6 +417,25 @@
}
/**
+ * Creates a QName whose namespace URI is the one associated with the parameter,
prefix, in the context of this SOAPElement.
+ * The remaining elements of the new QName are taken directly from the parameters,
localName and prefix.
+ * @param localName a String containing the local part of the name.
+ * @param prefix a String containing the prefix for the name.
+ * @return a QName with the specified localName and prefix, and with a namespace that
is associated with the prefix in the context of this SOAPElement.
+ * This namespace will be the same as the one that would be returned by
getNamespaceURI(String) if it were given prefix as it's parameter.
+ * @throws SOAPException if the QName cannot be created.
+ * @since SAAJ 1.3
+ */
+ public QName createQName(String localName, String prefix) throws SOAPException
+ {
+ String nsURI = getNamespaceURI(prefix);
+ if (nsURI == null)
+ throw new SOAPException("CAnnot obtain namespace URI for prefix: " +
prefix);
+
+ return new QName(nsURI, localName, prefix);
+ }
+
+ /**
* Returns an Iterator over all the immediate child Nodes of this element.
* <p/>
* This includes javax.xml.soap.Text objects as well as SOAPElement objects.
@@ -402,6 +498,11 @@
return list.iterator();
}
+ public Iterator getChildElements(QName qname)
+ {
+ return getChildElements(new NameImpl(qname));
+ }
+
/**
* Returns the name of this SOAPElement object.
*
@@ -515,6 +616,11 @@
return false;
}
+ public boolean removeAttribute(QName qname)
+ {
+ return removeAttribute(new NameImpl(qname));
+ }
+
/**
* Detaches all children of this SOAPElement.
* <p/>
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2006-12-13 01:30:26
UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPFactoryImpl.java 2006-12-13 13:13:27
UTC (rev 1637)
@@ -23,12 +23,15 @@
// $Id$
+import javax.xml.namespace.QName;
import javax.xml.soap.Detail;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.jaxrpc.binding.SOAPElementDeserializer;
import org.w3c.dom.Element;
@@ -78,4 +81,18 @@
{
return new NameImpl(localName);
}
+
+ @Override
+ public SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public SOAPFault createFault() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java 2006-12-13 01:30:26 UTC
(rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPFaultImpl.java 2006-12-13 13:13:27 UTC
(rev 1637)
@@ -33,6 +33,7 @@
import javax.xml.soap.SOAPFault;
import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.DOMUtils;
@@ -218,6 +219,11 @@
faultcode.setValue(faultCode);
}
+ public void setFaultCode(QName faultCode) throws SOAPException
+ {
+ setFaultCode(new NameImpl(faultCode));
+ }
+
/** Sets the fault string for this SOAPFault object to the given string.
*/
public void setFaultString(String faultString) throws SOAPException
@@ -237,4 +243,82 @@
{
new DOMWriter(writer).print(this);
}
+
+ public void addFaultReasonText(String text, Locale locale) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void appendFaultSubcode(QName subcode) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public QName getFaultCodeAsQName()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public String getFaultNode()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public Iterator getFaultReasonLocales() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public String getFaultReasonText(Locale locale) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public Iterator getFaultReasonTexts() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public String getFaultRole()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public Iterator getFaultSubcodes()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public boolean hasDetail()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void removeAllFaultSubcodes()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void setFaultNode(String uri) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void setFaultRole(String uri) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java 2006-12-13
01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderElementImpl.java 2006-12-13
13:13:27 UTC (rev 1637)
@@ -35,6 +35,7 @@
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
/**
@@ -139,4 +140,22 @@
writer.write(xmlFragment);
}
+
+ public boolean getRelay()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public boolean getRole()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void setRelay(boolean relay) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java 2006-12-13 01:30:26 UTC
(rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPHeaderImpl.java 2006-12-13 13:13:27 UTC
(rev 1637)
@@ -24,12 +24,14 @@
import java.util.ArrayList;
import java.util.Iterator;
+import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
+import org.jboss.util.NotImplementedException;
import org.w3c.dom.DOMException;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Node;
@@ -83,6 +85,11 @@
return headerElement;
}
+ public SOAPHeaderElement addHeaderElement(QName qname) throws SOAPException
+ {
+ return addHeaderElement(new NameImpl(qname));
+ }
+
/** Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader
object.
*/
public Iterator examineAllHeaderElements()
@@ -194,4 +201,28 @@
return super.replaceChild(newChild, oldChild);
}
+
+ public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws
SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public SOAPHeaderElement addUpgradeHeaderElement(Iterator soapURIs) throws
SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public SOAPHeaderElement addUpgradeHeaderElement(String[] soapURIs) throws
SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public SOAPHeaderElement addUpgradeHeaderElement(String soapURI) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-13 01:30:26
UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2006-12-13 13:13:27
UTC (rev 1637)
@@ -34,12 +34,14 @@
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
+import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
import org.jboss.ws.core.soap.attachment.CIDGenerator;
@@ -411,4 +413,18 @@
iterator.remove();
}
}
+
+ @Override
+ public AttachmentPart getAttachment(SOAPElement element) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void removeAttachments(MimeHeaders headers)
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2006-12-13 01:30:26 UTC
(rev 1636)
+++ trunk/src/main/java/org/jboss/ws/core/soap/SOAPPartImpl.java 2006-12-13 13:13:27 UTC
(rev 1637)
@@ -30,6 +30,7 @@
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -544,4 +545,40 @@
{
throw new NotImplementedException("setUserData");
}
+
+ public void detachNode()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public SOAPElement getParentElement()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public String getValue()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void recycleNode()
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void setParentElement(SOAPElement parent) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ public void setValue(String value)
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java 2006-12-13
01:30:26 UTC (rev 1636)
+++
trunk/src/main/java/org/jboss/ws/core/soap/attachment/AttachmentPartImpl.java 2006-12-13
13:13:27 UTC (rev 1637)
@@ -31,6 +31,8 @@
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
+import org.jboss.util.NotImplementedException;
+
/**
* Implementation of the <code>AttachmentPart</code> interface.
* @see javax.xml.soap.AttachmentPart
@@ -261,4 +263,46 @@
setMimeHeader(MimeConstants.CONTENT_TYPE, contentType);
cachedContentType = contentType;
}
+
+ @Override
+ public InputStream getBase64Content() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public InputStream getRawContent() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public byte[] getRawContentBytes() throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void setBase64Content(InputStream content, String contentType) throws
SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void setRawContent(InputStream content, String contentType) throws
SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void setRawContentBytes(byte[] content, int offset, int len, String
contentType) throws SOAPException
+ {
+ //TODO: SAAJ 1.3
+ throw new NotImplementedException();
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-12-13
01:30:26 UTC (rev 1636)
+++ trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLDefinitions.java 2006-12-13
13:13:27 UTC (rev 1637)
@@ -180,7 +180,7 @@
public void setWsdlNamespace(String namespaceURI)
{
- if (Constants.NS_WSDL11.equals(namespaceURI) == false &&
Constants.NS_WSDL20.equals(namespaceURI) == false)
+ if (Constants.NS_WSDL11.equals(namespaceURI) == false)
throw new IllegalArgumentException("Invalid default namespace: " +
namespaceURI);
this.wsdlNamespace = namespaceURI;
Modified: trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2006-12-13 01:30:26 UTC (rev
1636)
+++ trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2006-12-13 13:13:27 UTC (rev
1637)
@@ -105,7 +105,7 @@
*/
public JavaToWSDL(String namespace)
{
- if (Constants.NS_WSDL11.equals(namespace) == false &&
Constants.NS_WSDL20.equals(namespace) == false)
+ if (Constants.NS_WSDL11.equals(namespace) == false)
throw new IllegalArgumentException("Unsupported wsdl version: " +
namespace);
this.wsdlNamespace = namespace;
@@ -323,18 +323,6 @@
typeMapping = javaWSDL11.getTypeMapping();
javaWsdlMapping = javaWSDL11.getJavaWsdlMapping();
}
- if (Constants.NS_WSDL20.equals(wsdlNamespace))
- {
- JavaToWSDL20 javaWSDL20 = new JavaToWSDL20();
- javaWSDL20.addFeatures(features);
- javaWSDL20.setPortTypeName(portTypeName);
- javaWSDL20.setServiceName(serviceName);
- javaWSDL20.setTargetNamespace(targetNamespace);
-
- if( packageNamespaceMap != null)
- javaWSDL20.setPackageNamespaceMap(packageNamespaceMap);
- wsdlDefinitions = javaWSDL20.generate(endpoint);
- }
if (wsdlDefinitions == null)
throw new WSException("Cannot generate WSDL definitions");
Modified: trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java 2006-12-13
01:30:26 UTC (rev 1636)
+++ trunk/src/test/java/org/jboss/test/ws/tools/validation/WSDLValidator.java 2006-12-13
13:13:27 UTC (rev 1637)
@@ -129,11 +129,6 @@
String targetNS = wsdl.getTargetNamespace();
if (types == null)
errorList.add("types cannot be null");
- if (Constants.NS_WSDL20.equals(wsdl.getWsdlNamespace()))
- {
- if (WSDLUtils.getSchemaModel(types) == null)
- errorList.add("schema model is null");
- }
}
private void validateInterfaces()