axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r230888 - in /webservices/axis/trunk/java/modules: addressing/test/org/apache/axis2/handlers/addressing/ xml/src/org/apache/axis2/soap/ xml/src/org/apache/axis2/soap/impl/llom/ xml/src/org/apache/axis2/soap/impl/llom/factory/ xml/src/org/ap...
Date Mon, 08 Aug 2005 20:44:57 GMT
Author: gdaniels
Date: Mon Aug  8 13:44:47 2005
New Revision: 230888

URL: http://svn.apache.org/viewcvs?rev=230888&view=rev
Log:
* Make sure to write end tag in SOAPFaultImpl

* Add convenience method to add a header to a SOAPEnvelope

* Prep for changing default envelope to have no SOAPHeader

Modified:
    webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/SOAPEnvelope.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPEnvelopeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/factory/SOAPLinkedListImplFactory.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11Factory.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12Factory.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMEnvelopeTest.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPEnvelopeTest.java

Modified: webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
(original)
+++ webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
Mon Aug  8 13:44:47 2005
@@ -8,6 +8,7 @@
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.impl.llom.util.XMLComparator;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
 
 import javax.xml.namespace.QName;
@@ -70,8 +71,8 @@
 
         epr.setReferenceParameters(anyContentType);
 
-        SOAPEnvelope defaultEnvelope = OMAbstractFactory.getSOAP11Factory()
-                .getDefaultEnvelope();
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
 
         defaultEnvelope.getHeader().declareNamespace(Submission.WSA_NAMESPACE,
                 "wsa");

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/SOAPEnvelope.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/SOAPEnvelope.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/SOAPEnvelope.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/SOAPEnvelope.java Mon
Aug  8 13:44:47 2005
@@ -38,6 +38,15 @@
     public abstract SOAPHeader getHeader() throws OMException;
 
     /**
+     * Convenience method to add a SOAP header to this envelope
+     *
+     * @param namespaceURI
+     * @param name
+     */
+    public abstract SOAPHeaderBlock addHeader(String namespaceURI, String name)
+            throws OMException;
+
+    /**
      * Returns the <CODE>SOAPBody</CODE> object associated with
      * this <CODE>SOAPEnvelope</CODE> object.
      * <P> This SOAPBody will just be a container for all the BodyElements in the

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPEnvelopeImpl.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPEnvelopeImpl.java
Mon Aug  8 13:44:47 2005
@@ -21,6 +21,8 @@
 import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.soap.SOAPFactory;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -30,19 +32,22 @@
  */
 public class SOAPEnvelopeImpl extends SOAPElement
         implements SOAPEnvelope, OMConstants {
+    SOAPFactory factory;
 
     /**
      * @param builder
      */
-    public SOAPEnvelopeImpl(OMXMLParserWrapper builder) {
+    public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
         super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder);
+        this.factory = factory;
     }
 
     /**
      * @param ns
      */
-    public SOAPEnvelopeImpl(OMNamespace ns) {
+    public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
         super(SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns);
+        this.factory = factory;
     }
 
     /**
@@ -59,7 +64,32 @@
      * @throws OMException
      */
     public SOAPHeader getHeader() throws OMException {
-        return (SOAPHeader) getFirstChildWithName(new QName(SOAPConstants.HEADER_LOCAL_NAME));
+        SOAPHeader header =
+                (SOAPHeader)getFirstChildWithName(
+                        new QName(SOAPConstants.HEADER_LOCAL_NAME));
+        if (builder == null && header == null) {
+            header = factory.createSOAPHeader(this);
+            addChild(header);
+        }
+        return header;
+    }
+
+    /**
+     * Convenience method to add a SOAP header to this envelope
+     *
+     * @param namespaceURI
+     * @param name
+     */
+    public SOAPHeaderBlock addHeader(String namespaceURI, String name)
+            throws OMException {
+        // TODO : cache SOAP header and body instead of looking them up?
+
+        SOAPHeader headerContainer = getHeader();
+        OMNamespace namespace = factory.createOMNamespace(namespaceURI, null);
+        SOAPHeaderBlock block = factory.createSOAPHeaderBlock(name,
+                                                              namespace,
+                                                              headerContainer);
+        return block;
     }
 
     public void addChild(OMNode child) {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
Mon Aug  8 13:44:47 2005
@@ -209,14 +209,12 @@
             faultRole.serializeWithCache(omOutput);
         }
 
-
-
         SOAPFaultDetail faultDetail = getDetail();
         if (faultDetail != null) {
             faultDetail.serializeWithCache(omOutput);
         }
 
-
+        OMSerializerUtil.serializeEndpart(omOutput);
     }
 
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/factory/SOAPLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/factory/SOAPLinkedListImplFactory.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/factory/SOAPLinkedListImplFactory.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/factory/SOAPLinkedListImplFactory.java
Mon Aug  8 13:44:47 2005
@@ -28,9 +28,8 @@
      * Eran Chinthaka (chinthaka@apache.org)
      */
 
-
     public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) {
-        return new SOAPEnvelopeImpl(builder);
+        return new SOAPEnvelopeImpl(builder, this);
     }
 
     public SOAPEnvelope createSOAPEnvelope() {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11Factory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11Factory.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11Factory.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11Factory.java
Mon Aug  8 13:44:47 2005
@@ -33,7 +33,8 @@
         return new SOAPEnvelopeImpl(
                 new OMNamespaceImpl(
                         SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
-                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX));
+                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+                this);
     }
 
     public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException
{
@@ -179,9 +180,9 @@
                 new OMNamespaceImpl(
                         SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                         SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
-        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns);
-        SOAPHeader headerImpl = createSOAPHeader(env);
-        SOAPBody bodyImpl = createSOAPBody(env);
+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+        createSOAPHeader(env);
+        createSOAPBody(env);
         return env;
     }
 

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12Factory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12Factory.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12Factory.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12Factory.java
Mon Aug  8 13:44:47 2005
@@ -33,7 +33,8 @@
         return new SOAPEnvelopeImpl(
                 new OMNamespaceImpl(
                         SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
-                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX));
+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+                this);
     }
 
     public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException
{
@@ -179,9 +180,9 @@
                 new OMNamespaceImpl(
                         SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                         SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
-        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns);
-        SOAPHeader headerImpl = createSOAPHeader(env);
-        SOAPBody bodyImpl = createSOAPBody(env);
+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+        createSOAPHeader(env);
+        createSOAPBody(env);
 
         return env;
     }

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMEnvelopeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMEnvelopeTest.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMEnvelopeTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMEnvelopeTest.java Mon
Aug  8 13:44:47 2005
@@ -73,9 +73,6 @@
             fail(e.getMessage());
         }
         assertNotNull(env);
-        assertNotNull("Header should not be null", env.getHeader());
         assertNotNull("Body should not be null", env.getBody());
-
     }
-
 }

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPEnvelopeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPEnvelopeTest.java?rev=230888&r1=230887&r2=230888&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPEnvelopeTest.java
(original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/soap/SOAPEnvelopeTest.java
Mon Aug  8 13:44:47 2005
@@ -25,7 +25,11 @@
     public SOAPEnvelopeTest(String testName) {
         super(testName);
         soap11Envelope = soap11Factory.getDefaultEnvelope();
+        // Toss in a header to make sure the SOAPHeader gets set up
+        soap11Envelope.addHeader("http://ns", "dummy");
         soap12Envelope = soap12Factory.getDefaultEnvelope();
+        // Toss in a header to make sure the SOAPHeader gets set up
+        soap12Envelope.addHeader("http://ns", "dummy");
     }
 
     //SOAP 1.1 Envelope Test (Programaticaly Created)-----------------------------------------------



Mime
View raw message