Author: heiko.braun(a)jboss.com
Date: 2007-09-24 04:53:53 -0400 (Mon, 24 Sep 2007)
New Revision: 4612
Modified:
stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java
stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java
stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java
Log:
JBCTS-312: javax.xml.soap signature tests
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java 2007-09-22
12:47:12 UTC (rev 4611)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SOAPConnection.java 2007-09-24
08:53:53 UTC (rev 4612)
@@ -21,8 +21,6 @@
*/
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).
*
@@ -43,7 +41,7 @@
public abstract class SOAPConnection
{
public SOAPConnection()
- {
+ {
}
/** Sends the given message to the specified endpoint and blocks until it has returned
the response.
@@ -63,7 +61,10 @@
* @throws SOAPException if there is a SOAP error
* @since SAAJ 1.3
*/
- public abstract SOAPMessage get(Object to) throws SOAPException;
+ public SOAPMessage get(Object to) throws SOAPException
+ {
+ throw new IllegalArgumentException("Should be implemented by concrete
implementation of this class");
+ }
/** Closes this SOAPConnection object.
*
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2007-09-22 12:47:12
UTC (rev 4611)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2007-09-24 08:53:53
UTC (rev 4612)
@@ -23,10 +23,11 @@
// $Id$
+import org.w3c.dom.Element;
+
import javax.xml.namespace.QName;
+import java.lang.reflect.Method;
-import org.w3c.dom.Element;
-
/** 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,15 +42,15 @@
public abstract class SOAPFactory
{
private static SOAPFactory soapFactory;
-
- /**
- * Creates a new SOAPFactory object that is an instance of the default implementation
(SOAP 1.1),
+
+ /**
+ * 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.
+ * 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
@@ -61,20 +62,23 @@
try
{
String propertyName = "javax.xml.soap.SOAPFactory";
- soapFactory = (SOAPFactory)SAAJFactoryLoader.loadFactory(propertyName,
null);
+
+ Class loaderClass =
Class.forName("org.jboss.ws.soap.SAAJFactoryLoader");
+ Method m = loaderClass.getMethod("loadFactory", new Class[]
{String.class, String.class});
+ soapFactory = (SOAPFactory)m.invoke(null, new Object[] {propertyName,
null});
}
- catch (RuntimeException rte)
+ catch (Exception rte)
{
throw new SOAPException(rte);
}
-
+
// Use the SAAJMetaFactory instance to locate the MessageFactory implementation
class.
if (soapFactory == null)
{
SAAJMetaFactory saajFactory = SAAJMetaFactory.getInstance();
soapFactory =
saajFactory.newSOAPFactory(SOAPConstants.DEFAULT_SOAP_PROTOCOL);
}
-
+
if (soapFactory == null)
throw new SOAPException("Failed to to determine the SOAPFactory
implementation class");
}
@@ -83,10 +87,10 @@
/**
- * Creates a new SOAPFactory object that is an instance of the specified
implementation, this method uses the SAAJMetaFactory
+ * 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.
+ *
+ * @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
@@ -95,13 +99,13 @@
{
SAAJMetaFactory saajFactory = SAAJMetaFactory.getInstance();
SOAPFactory factory = saajFactory.newSOAPFactory(protocol);
-
+
if (factory == null)
throw new SOAPException("Failed to to determine the SOAPFactory
implementation class");
-
+
return factory;
}
-
+
/** 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.
@@ -112,16 +116,19 @@
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
+ * 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 abstract SOAPElement createElement(Element domElement) throws SOAPException;
+ public SOAPElement createElement(Element domElement) throws SOAPException
+ {
+ throw new IllegalArgumentException("Should be implemented by concrete
implementation of this class");
+ }
/** Create a SOAPElement object initialized with the given local name.
*
@@ -150,16 +157,19 @@
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
+ * 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 abstract SOAPElement createElement(QName qname) throws SOAPException;
+ public SOAPElement createElement(QName qname) throws SOAPException
+ {
+ throw new IllegalArgumentException("Should be implemented by concrete
implementation of this class");
+ }
/**
* Creates a new SOAPFault object initialized with the given reasonText and
faultCode
Modified: stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2007-09-22
12:47:12 UTC (rev 4611)
+++ stack/native/trunk/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2007-09-24
08:53:53 UTC (rev 4612)
@@ -54,14 +54,14 @@
/**
* 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 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.
+ * @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;
@@ -74,7 +74,7 @@
*/
public String getRole();
- /**
+ /**
* Sets the Role associated with this SOAPHeaderElement object to the specified
Role.
*
* @param roleURI the URI of the Role
@@ -82,7 +82,7 @@
* @throws UnsupportedOperationException if this message does not support the SOAP 1.2
concept of Fault Role
* @since SAAJ 1.3
*/
- public void setRole(String roleURI);
+ public void setRole(String roleURI) throws SOAPException;
/** Sets the actor associated with this SOAPHeaderElement object to the specified
actor.
* The default value of an actor is: SOAPConstants.URI_SOAP_ACTOR_NEXT