Author: chinthaka
Date: Fri Nov 24 03:21:19 2006
New Revision: 478835

URL: http://svn.apache.org/viewvc?view=rev&rev=478835
Log:
- Improving identify SOAP version logic a bit
- removing a System out in a test.


Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java?view=diff&rev=478835&r1=478834&r2=478835
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
 Fri Nov 24 03:21:19 2006
@@ -135,13 +135,15 @@
         }
 
         envelopeNamespace = soapEnvelope.getNamespace();
-        String namespaceName = envelopeNamespace.getNamespaceURI();
-        if ((soapVersionURIFromTransport != null) && 
!(soapVersionURIFromTransport.equals(namespaceName)))
-        {
-            throw new SOAPProcessingException("Transport level information 
does not match with SOAP" +
-                    " Message namespace URI", envelopeNamespace.getPrefix() + 
":" + SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
 
+        if (soapVersionURIFromTransport != null) {
+            String namespaceName = envelopeNamespace.getNamespaceURI();
+            if (!(soapVersionURIFromTransport.equals(namespaceName))){
+                throw new SOAPProcessingException("Transport level information 
does not match with SOAP" +
+                        " Message namespace URI", 
envelopeNamespace.getPrefix() + ":" + 
SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+            }
         }
+
     }
 
     /**
@@ -171,9 +173,9 @@
             node = constructNode(null, elementName, true);
             setSOAPEnvelope(node);
         } else if (lastNode.isComplete()) {
-            node =constructNode((OMElement) lastNode.getParent(),
-                            elementName,
-                            false);
+            node = constructNode((OMElement) lastNode.getParent(),
+                    elementName,
+                    false);
             ((OMNodeEx) lastNode).setNextOMSibling(node);
             ((OMNodeEx) node).setPreviousOMSibling(lastNode);
         } else {
@@ -232,8 +234,8 @@
             soapMessage = soapFactory.createSOAPMessage(this);
             this.document = soapMessage;
             if (charEncoding != null) {
-               document.setCharsetEncoding(charEncoding);
-             }
+                document.setCharsetEncoding(charEncoding);
+            }
 
             envelope = soapFactory.createSOAPEnvelope(this);
             element = envelope;
@@ -302,10 +304,12 @@
 
 
             processingFault = true;
-            if 
(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI()))
 {
+            if 
(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI()))
+            {
                 builderHelper = new SOAP12BuilderHelper(this);
             } else
-            if 
(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI()))
 {
+            if 
(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI()))
+            {
                 builderHelper = new SOAP11BuilderHelper(this);
             }
 
@@ -371,7 +375,7 @@
      * @return Returns OMElement.
      */
     public OMElement getDocumentElement() {
-        return getSOAPEnvelope();
+        return envelope != null ? envelope : getSOAPEnvelope();
     }
 
     /**

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java?view=diff&rev=478835&r1=478834&r2=478835
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java
 Fri Nov 24 03:21:19 2006
@@ -40,7 +40,6 @@
         if (files != null) {
             for (int i = 0; i < files.length; i++) {
                 if (files[i].isFile() && files[i].getName().endsWith(".xml") 
&& !files[i].getName().startsWith("wrong")) {
-                    System.out.println(files[i].getAbsolutePath());
                     SOAPEnvelope soapEnvelope = (SOAPEnvelope) 
OMTestUtils.getOMBuilder(
                             files[i])
                             .getDocumentElement();



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to