You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/03/12 22:50:13 UTC
svn commit: r1299894 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/soap/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/ axiom-dom...
Author: veithen
Date: Mon Mar 12 21:50:13 2012
New Revision: 1299894
URL: http://svn.apache.org/viewvc?rev=1299894&view=rev
Log:
Fixed a couple of issues and inconsitencies in DOOM's SOAP implementation.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetDefaultEnvelope.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetNamespace.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java Mon Mar 12 21:50:13 2012
@@ -20,6 +20,7 @@
package org.apache.axiom.soap;
import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
@@ -375,15 +376,26 @@ public interface SOAPFactory extends OMF
/**
- * Method getDefaultEnvelope. This returns a SOAP envelope consisting with an empty Header and a
- * Body. This is just a util method which can be used everywhere.
- *
- * @return Returns SOAPEnvelope.
+ * Create a default SOAP envelope with an empty header and an empty body. Note that the method
+ * will not create an associated {@link SOAPMessage} or {@link OMDocument} instance and the
+ * parent of the returned {@link SOAPEnvelope} is <code>null</code>.
+ *
+ * @return the default SOAP envelope
*/
SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException;
SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException;
+ /**
+ * Get the envelope namespace for the SOAP version used by this factory. The returned
+ * {@link OMNamespace} instance has the following properties:
+ * <ul>
+ * <li>The prefix is set to {@link SOAPConstants#SOAP_DEFAULT_NAMESPACE_PREFIX} (which is the
+ * same as the prefix used by methods such as {@link #createSOAPEnvelope()}).
+ * <li>The namespace URI is the same as returned by {@link #getSoapVersionURI()}.
+ * </ul>
+ *
+ * @return the envelope namespace for the SOAP version used by this factory
+ */
OMNamespace getNamespace();
-
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Mon Mar 12 21:50:13 2012
@@ -71,7 +71,6 @@ public class SOAPEnvelopeImpl extends SO
public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
super(((DOMSOAPFactory) factory).getDocument(),
SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory);
- this.getOwnerDocument().appendChild(this);
}
public SOAPVersion getVersion() {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java Mon Mar 12 21:50:13 2012
@@ -22,9 +22,11 @@ package org.apache.axiom.soap.impl.dom.f
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.om.impl.dom.DocumentImpl;
import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
+import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
@@ -78,6 +80,13 @@ public abstract class DOMSOAPFactory ext
return new SOAP12FaultImpl(parent, this);
}
+ public final SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+ SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(getNamespace(), this);
+ createSOAPHeader(env);
+ createSOAPBody(env);
+ return env;
+ }
+
public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());
@@ -139,10 +148,6 @@ public abstract class DOMSOAPFactory ext
return new SOAP11FaultDetailImpl(this);
}
- public OMNamespace getNamespace() {
- throw new UnsupportedOperationException();
- }
-
public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, OMDataSource ds) throws SOAPProcessingException {
throw new UnsupportedOperationException("TODO");
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java Mon Mar 12 21:50:13 2012
@@ -240,17 +240,6 @@ public class SOAP11Factory extends DOMSO
return new SOAP11FaultDetailImpl(parent, builder, this);
}
- public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
- OMNamespace ns =
- new OMNamespaceImpl(
- SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
- SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
- SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
- createSOAPHeader(env);
- createSOAPBody(env);
- return env;
- }
-
public OMNamespace getNamespace() {
return new OMNamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java Mon Mar 12 21:50:13 2012
@@ -228,16 +228,9 @@ public class SOAP12Factory extends DOMSO
return new SOAP12FaultDetailImpl(parent, builder, this);
}
- public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
- OMNamespace ns =
- new OMNamespaceImpl(
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
- SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
- SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
- createSOAPHeader(env);
- createSOAPBody(env);
-
- return env;
+ public OMNamespace getNamespace() {
+ return new OMNamespaceImpl(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
}
public SOAPFault createSOAPFault() throws SOAPProcessingException {
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java Mon Mar 12 21:50:13 2012
@@ -19,7 +19,6 @@
package org.apache.axiom.soap.impl.llom;
-import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMTestCase;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.TestConstants;
@@ -72,10 +71,4 @@ public class OMEnvelopeTest extends OMTe
(body != null && body.getLocalName().equalsIgnoreCase("Body")));
body.close(false);
}
-
- public void testDefaultEnveleope() {
- SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
- assertNotNull(env);
- assertNotNull("Body should not be null", env.getBody());
- }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Mon Mar 12 21:50:13 2012
@@ -54,8 +54,10 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.envelope.TestHasFaultWithParser(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelope(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelopeWithCustomPrefix(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.factory.TestGetDefaultEnvelope(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.factory.TestGetMetaFactory(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.factory.TestGetNamespace(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestGetCode(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestGetCodeWithParser(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestGetDetail(metaFactory, spec));
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java?rev=1299894&r1=1299893&r2=1299894&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java Mon Mar 12 21:50:13 2012
@@ -34,14 +34,22 @@ public class TestCreateSOAPEnvelope exte
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.createSOAPEnvelope();
+
+ // Check name
assertEquals(SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX, env.getNamespace().getPrefix());
assertEquals(spec.getEnvelopeNamespaceURI(), env.getNamespace().getNamespaceURI());
assertEquals(SOAPConstants.SOAPENVELOPE_LOCAL_NAME, env.getLocalName());
+
+ // Check declared namespaces
Iterator it = env.getAllDeclaredNamespaces();
assertTrue(it.hasNext());
OMNamespace ns = (OMNamespace)it.next();
assertEquals(SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX, ns.getPrefix());
assertEquals(spec.getEnvelopeNamespaceURI(), ns.getNamespaceURI());
assertFalse(it.hasNext());
+
+ // Check parent/children
+ assertNull(env.getParent());
+ assertNull(env.getFirstOMChild());
}
}
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetDefaultEnvelope.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetDefaultEnvelope.java?rev=1299894&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetDefaultEnvelope.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetDefaultEnvelope.java Mon Mar 12 21:50:13 2012
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.soap.factory;
+
+import java.util.Iterator;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Checks the content of the SOAP envelope returned by {@link SOAPFactory#getDefaultEnvelope()}.
+ */
+public class TestGetDefaultEnvelope extends SOAPTestCase {
+ public TestGetDefaultEnvelope(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPEnvelope env = soapFactory.getDefaultEnvelope();
+
+ // Check correct SOAP version
+ assertEquals(spec.getEnvelopeNamespaceURI(), env.getNamespaceURI());
+
+ // getDefaultEnvelope doesn't create a SOAPMessage/OMDocument
+ assertNull(env.getParent());
+
+ // Check the children
+ Iterator it = env.getChildren();
+ assertTrue(it.hasNext());
+ OMNode child = (OMNode)it.next();
+ assertTrue(child instanceof SOAPHeader);
+ assertNull(((SOAPHeader)child).getFirstOMChild());
+ child = (OMNode)it.next();
+ assertTrue(child instanceof SOAPBody);
+ assertNull(((SOAPBody)child).getFirstOMChild());
+ assertFalse(it.hasNext());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetDefaultEnvelope.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetNamespace.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetNamespace.java?rev=1299894&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetNamespace.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetNamespace.java Mon Mar 12 21:50:13 2012
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.soap.factory;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestGetNamespace extends SOAPTestCase {
+ public TestGetNamespace(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec);
+ }
+
+ protected void runTest() throws Throwable {
+ OMNamespace ns = soapFactory.getNamespace();
+ assertEquals(SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX, ns.getPrefix());
+ assertEquals(spec.getEnvelopeNamespaceURI(), ns.getNamespaceURI());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestGetNamespace.java
------------------------------------------------------------------------------
svn:eol-style = native