You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2005/12/19 19:43:17 UTC

svn commit: r357749 - in /webservices/axis2/trunk/java/modules: codegen/test/org/apache/axis2/wsdl/ integration/test/org/apache/axis2/security/ saaj/src/org/apache/axis2/om/ saaj/src/org/apache/axis2/om/impl/dom/ saaj/src/org/apache/axis2/om/impl/dom/f...

Author: ruchithf
Date: Mon Dec 19 10:39:45 2005
New Revision: 357749

URL: http://svn.apache.org/viewcvs?rev=357749&view=rev
Log:
Fixed a few DOOM bugs:
- Return the correct document in the OMDOMFactory
- When a soap envelope is created progammatically add it to the parent document
- Check the ns declarations in the parent element when looking up declared namespaces

And
- Making sure SOAP 1.2 works with DOOM and Security module
- Changed the security test cases to use SOAP 1.2 when testing with the static configuration


Added:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/DOOMAbstractFactory.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDL2JavaTest.java Mon Dec 19 10:39:45 2005
@@ -39,7 +39,7 @@
     public static final String OUTPUT_LOCATION_PREFIX = "/test";
     private static int folderCount = 0;
     // public static final String OUTPUT_LOCATION_BASE = "C:\\GeneratedCode\\test4\\src";
-    public static final String WSDL_BASE_DIR = "./test-resources/";
+    public static final String WSDL_BASE_DIR = "test-resources/";
     public static final String CLASSES_DIR = "/target/classes/";
     private String[] moduleNames={"xml","common","core"};
     private static final String MODULE_PATH_PREFIX = "../modules/";

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/AddressingMTOMSecurityTest.java Mon Dec 19 10:39:45 2005
@@ -55,6 +55,13 @@
 	protected String getServiceRepo() {
 		return COMPLETE_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
 	
 	
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/InteropTestBase.java Mon Dec 19 10:39:45 2005
@@ -113,23 +113,23 @@
 	 * Do test
 	 */
     public void testInteropWithConfigFiles() {
-//    	try {
-//    		InteropScenarioClient client = new InteropScenarioClient();
-//    		client.invokeWithStaticConfig(Constants.TESTING_PATH + getClientRepo(),targetEpr);
-//    	} catch (Exception e) {
-//    		e.printStackTrace();
-//    		fail("Error in introperating with " + targetEpr + ", client configuration: " + getClientRepo());
-//    	}
+    	try {
+    		InteropScenarioClient client = new InteropScenarioClient(this.isUseSOAP12InStaticConfigTest());
+    		client.invokeWithStaticConfig(Constants.TESTING_PATH + getClientRepo(),targetEpr);
+    	} catch (Exception e) {
+    		e.printStackTrace();
+    		fail("Error in introperating with " + targetEpr + ", client configuration: " + getClientRepo());
+    	}
     }
 
     public void testInteropWithDynamicConfig() {
-//    	try {
-//    		InteropScenarioClient client = new InteropScenarioClient();
-//    		client.invokeWithGivenConfig(Constants.TESTING_PATH + DEFAULT_CLIENT_REPOSITORY,targetEpr,getOutflowConfiguration(), getInflowConfiguration());
-//    	} catch (Exception e) {
-//    		e.printStackTrace();
-//    		fail("Error in introperating with " + targetEpr + ", client configuration: " + getClientRepo());
-//    	}
+    	try {
+    		InteropScenarioClient client = new InteropScenarioClient(this.isUseSOAP12InStaticConfigTest());
+    		client.invokeWithGivenConfig(Constants.TESTING_PATH + DEFAULT_CLIENT_REPOSITORY,targetEpr,getOutflowConfiguration(), getInflowConfiguration());
+    	} catch (Exception e) {
+    		e.printStackTrace();
+    		fail("Error in introperating with " + targetEpr + ", client configuration: " + getClientRepo());
+    	}
 
     }
     
@@ -140,4 +140,6 @@
     protected abstract String getClientRepo();
     
     protected abstract String getServiceRepo();
+    
+    protected abstract boolean isUseSOAP12InStaticConfigTest();
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/MTOMOptimizedSecurityTest.java Mon Dec 19 10:39:45 2005
@@ -58,5 +58,12 @@
 	protected String getServiceRepo() {
 		return MTOM_SEC_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
 	
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario1Test.java Mon Dec 19 10:39:45 2005
@@ -45,4 +45,11 @@
 		return SCENARIO1_SERVICE_REPOSITORY;
 	}
 
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
+
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2Test.java Mon Dec 19 10:39:45 2005
@@ -54,4 +54,11 @@
 	protected String getServiceRepo() {
 		return SCENARIO2_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario2aTest.java Mon Dec 19 10:39:45 2005
@@ -52,4 +52,11 @@
 	protected String getServiceRepo() {
 		return SCENARIO2a_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario3Test.java Mon Dec 19 10:39:45 2005
@@ -59,5 +59,12 @@
 		return SCENARIO3_SERVICE_REPOSITORY;
 	}
 
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
+
 	
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario4Test.java Mon Dec 19 10:39:45 2005
@@ -60,4 +60,11 @@
 		return SCENARIO4_SERVICE_REPOSITORY;
 	}
 
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
+
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario5Test.java Mon Dec 19 10:39:45 2005
@@ -56,4 +56,11 @@
 	protected String getServiceRepo() {
 		return SCENARIO5_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario6Test.java Mon Dec 19 10:39:45 2005
@@ -59,4 +59,11 @@
 	protected String getServiceRepo() {
 		return SCENARIO6_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return true;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/Scenario7Test.java Mon Dec 19 10:39:45 2005
@@ -62,4 +62,11 @@
 	protected String getServiceRepo() {
 		return SCENARIO7_SERVICE_REPOSITORY;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		return false;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/ScenarioST1Test.java Mon Dec 19 10:39:45 2005
@@ -42,4 +42,12 @@
 		return SCENARIO_ST1_SERVICE_REPOSITORY;
 	}
 
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.InteropTestBase#useSOAP12()
+	 */
+	protected boolean isUseSOAP12InStaticConfigTest() {
+		// TODO TODO
+		throw new UnsupportedOperationException("TODO");
+	}
+
 }

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/DOOMAbstractFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/DOOMAbstractFactory.java?rev=357749&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/DOOMAbstractFactory.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/DOOMAbstractFactory.java Mon Dec 19 10:39:45 2005
@@ -0,0 +1,28 @@
+/**
+ * 
+ */
+package org.apache.axis2.om;
+
+import org.apache.axis2.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.dom.soap11.SOAP11Factory;
+import org.apache.axis2.soap.impl.dom.soap12.SOAP12Factory;
+
+/**
+ *
+ * @author Ruchith Fernando (ruchith.fernando@gmail.com)
+ */
+public class DOOMAbstractFactory {
+
+	public static OMFactory getOMFactory() {
+		return new OMDOMFactory();
+	}
+	
+	public static SOAPFactory getSOAP11Factory() {
+		return new SOAP11Factory();
+	}
+
+	public static SOAPFactory getSOAP12Factory() {
+		return new SOAP12Factory();
+	}
+}

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java Mon Dec 19 10:39:45 2005
@@ -26,6 +26,7 @@
 
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMConstants;
+import org.apache.axis2.om.OMContainer;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
@@ -612,7 +613,12 @@
 	}
 
     public OMNamespace findNamespaceURI(String prefix) {
-        return (OMNamespace)this.namespaces.get(prefix);
+        OMNamespace ns = (OMNamespace) this.namespaces.get(prefix);
+        if (ns == null && this.parentNode instanceof OMElement) {
+            // try with the parent
+            ns = ((OMElement) this.parentNode).findNamespaceURI(prefix);
+        }
+        return ns;
     }
 
     /**
@@ -1062,11 +1068,14 @@
     
     /**
      * return the namespace uri, given the prefix
+     * if its not found at the this element it will 
+     * search the parent
      * @param prefix
      * @return namespace
      */
     public String getNamespaceURI(String prefix) {
-    	return ((OMNamespace)this.namespaces.get(prefix)).getName();
+    	OMNamespace ns = this.findNamespaceURI(prefix);
+    	return (ns != null) ? ns.getName() : null;
     }
     
     /**
@@ -1083,7 +1092,6 @@
     	} else {
     		return false;
     	}
-    	
     }
     
     

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java Mon Dec 19 10:39:45 2005
@@ -241,7 +241,7 @@
 	}
 	
 	public DocumentImpl getDocument() {
-		return this.document;
+		return (DocumentImpl)this.createOMDocument();
 	}
 
 

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java Mon Dec 19 10:39:45 2005
@@ -61,6 +61,7 @@
 	public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
 		super(((DOMSOAPFactory) factory).getDocument(),
 				SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns);
+		this.getOwnerDocument().appendChild(this);
 		this.factory = factory;
 	}
 

Modified: webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java (original)
+++ webservices/axis2/trunk/java/modules/security/interop/org/apache/axis2/security/InteropScenarioClient.java Mon Dec 19 10:39:45 2005
@@ -26,6 +26,8 @@
 import org.apache.axis2.security.handler.WSSHandlerConstants;
 import org.apache.axis2.security.handler.config.InflowConfiguration;
 import org.apache.axis2.security.handler.config.OutflowConfiguration;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
 
 
 /**
@@ -34,7 +36,14 @@
  */
 public class InteropScenarioClient {
 
-
+	String soapNsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+	
+	public InteropScenarioClient(boolean useSOAP12InStaticConfigTest) {
+		if(useSOAP12InStaticConfigTest) {
+			soapNsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+		}
+	}
+	
     public void invokeWithStaticConfig(String clientRepo, String url) throws Exception {
         TicketType ticket = TicketType.Factory.newInstance();
         ticket.setId("My ticket Id");
@@ -51,7 +60,8 @@
         //Enable MTOM to those scenarios where they are configured using:
         //<optimizeParts>xpathExpression</optimizeParts>
         stub._getClientOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
-
+        stub._getClientOptions().setSoapVersionURI(soapNsURI);
+        
         PingResponseDocument pingResDoc = stub.Ping(pingDoc);
 
         PingResponse pingRes = pingResDoc.getPingResponse();
@@ -66,16 +76,16 @@
         Ping ping = Ping.Factory.newInstance();
         ping.setText("Testing axis2-wss4j module");
         ping.setTicket(ticket);
-
+        
         PingDocument pingDoc = PingDocument.Factory.newInstance();
         pingDoc.setPing(ping);
 
         PingPortStub stub = new PingPortStub(clientRepo,url);
-
+        
         //Enable MTOM to those scenarios where they are configured using:
         //<optimizeParts>xpathExpression</optimizeParts>
         stub._getClientOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
-
+        
         //Engage the security module
         stub.engageModule("security");
 

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java Mon Dec 19 10:39:45 2005
@@ -24,16 +24,17 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.axis2.om.DOOMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.impl.dom.DocumentImpl;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.security.handler.WSSHandlerConstants;
 import org.apache.axis2.security.trust.TrustException;
 import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.impl.dom.soap11.SOAP11Factory;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-import org.apache.ws.security.SOAPConstants;
 import org.apache.ws.security.WSSecurityException;
 import org.apache.xml.security.utils.XMLUtils;
 import org.w3c.dom.Document;
@@ -54,7 +55,19 @@
 			throws WSSecurityException {
 		try {
 			env.build();
-			StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(),new SOAP11Factory(), SOAPConstants.SOAP11_CONSTANTS.getEnvelopeURI());
+			
+			//Check the namespace and find SOAP version and factory
+			String nsURI = null;
+			SOAPFactory factory;
+			if(env.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+				nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+				factory = DOOMAbstractFactory.getSOAP11Factory();
+			} else {
+				nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+				factory = DOOMAbstractFactory.getSOAP11Factory();
+			}
+			
+			StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(),factory, nsURI);
 			SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
 			envelope.build();
 			
@@ -69,7 +82,7 @@
 
 	public static SOAPEnvelope getSOAPEnvelopeFromDOOMDocument(DocumentImpl doc) {
         OMElement docElem = (OMElement)doc.getDocumentElement();
-        StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+        StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
         return stAXSOAPModelBuilder.getSOAPEnvelope();
 	}
 	

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=357749&r1=357748&r2=357749&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java Mon Dec 19 10:39:45 2005
@@ -331,9 +331,6 @@
             }
         }
 
-//        if (namespace == null && uri != null && prefix != null) {
-//            namespace = declareNamespace(uri, prefix);
-//        }
         return namespace;
     }
 
@@ -343,7 +340,7 @@
             // try with the parent
             ns = ((OMElement) this.parent).findNamespaceURI(prefix);
         }
-        return ns;  //To change body of implemented methods use File | Settings | File Templates.
+        return ns;
     }
 
     /**