axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r637655 - in /webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator: EndpointDescriptionValidator.java ValidationFailures.java
Date Sun, 16 Mar 2008 20:48:38 GMT
Author: scheu
Date: Sun Mar 16 13:48:36 2008
New Revision: 637655

URL: http://svn.apache.org/viewvc?rev=637655&view=rev
Log:
Quick Fix
Updated the validation message for the case where the wsdl binding and the annotation are
mismatched.
Added additional debug trace so that it will be easier to determine where a ValidationFailure
originated.

Modified:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java?rev=637655&r1=637654&r2=637655&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/EndpointDescriptionValidator.java
Sun Mar 16 13:48:36 2008
@@ -130,10 +130,23 @@
                                  "An HTTPBinding must use an @WebServiceProvider endpoint.");
             isBindingValid = false;
         } else {
-            addValidationFailure(this, "Invalid binding; wsdl = " + wsdlBindingType +
-                    ", annotation = " + bindingType);
+            
+            // Mismatched bindings 
+            String wsdlInsert = "[" + bindingHumanReadableDescription(wsdlBindingType) +
"]" +
+                "namespace = {" + wsdlBindingType +"}";
+            String annotationInsert = "[" + bindingHumanReadableDescription(bindingType)
+ "]" +
+                "namespace = {" + bindingType +"}";
+            
+            // TODO NLS
+            String message = "There is a mismatch between the wsdl and annotation information.
 " +
+                "Please make sure both use the same binding namespace.  " +
+                "The wsdl =" + wsdlInsert + ".  " +
+                "The annotation = " + annotationInsert + ".";
+            addValidationFailure(this, message);
+            
             isBindingValid = false;
-        }
+        } 
+        
         return isBindingValid;
     }
 
@@ -167,5 +180,29 @@
             }
         }
         return VALID;
+    }
+    
+    private static String bindingHumanReadableDescription(String ns) {
+        if (SOAPBinding.SOAP11HTTP_BINDING.equals(ns)) {
+            return "SOAP 1.1 HTTP Binding";
+        } else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(ns)) {
+            return "SOAP 1.1 MTOM HTTP Binding";
+        } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(ns)) {
+            return "SOAP 1.2 HTTP Binding";
+        } else if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(ns)) {
+            return "SOAP 1.2 MTOM HTTP Binding";
+        } else if (MDQConstants.SOAP11JMS_BINDING.equals(ns)) {
+            return "SOAP 1.1 JMS Binding";
+        } else if (MDQConstants.SOAP11JMS_MTOM_BINDING.equals(ns)) {
+            return "SOAP 1.1 MTOM JMS Binding";
+        } else if (MDQConstants.SOAP12JMS_BINDING.equals(ns)) {
+            return "SOAP 1.2 JMS Binding";
+        } else if (MDQConstants.SOAP12JMS_MTOM_BINDING.equals(ns)) {
+            return "SOAP 1.2 MTOM JMS Binding";
+        } else if (HTTPBinding.HTTP_BINDING.equals(ns)) {
+            return "XML HTTP Binding";
+        } else {
+            return "Unknown Binding";
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java?rev=637655&r1=637654&r2=637655&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/validator/ValidationFailures.java
Sun Mar 16 13:48:36 2008
@@ -19,19 +19,31 @@
 
 package org.apache.axis2.jaxws.description.validator;
 
+import org.apache.axis2.util.JavaUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.util.ArrayList;
 import java.util.List;
 
 
 /**
- * 
+ * Record Validator Failures.
+ * The validator failures are gathered and then issued at the end of the validation phase.
  */
 public class ValidationFailures {
 
+    private static final Log log = LogFactory.getLog(ValidationFailures.class);
     ArrayList<ValidationFailure> validationFailures = new ArrayList<ValidationFailure>();
 
     public void add(Validator failingValidator, String message) {
-        validationFailures.add(new ValidationFailure(failingValidator, message));
+        ValidationFailure vf = new ValidationFailure(failingValidator, message);
+        validationFailures.add(vf);
+        
+        if (log.isDebugEnabled()) {
+            log.debug("Adding ValidationFailure = " + vf.toString());
+            log.debug("Location of Validation Failure = " + JavaUtils.callStackToString());
+        }
     }
 
     public List<ValidationFailure> getValidationFailures() {
@@ -40,6 +52,10 @@
 
 }
 
+/**
+ * "Specific Validator Failures
+ *
+ */
 class ValidationFailure {
     Validator validator;
     String message;
@@ -56,4 +72,9 @@
     public Validator getValidator() {
         return validator;
     }
+
+    public String toString() {
+       return "Validator = [" + validator + "] Message = [" + message + "]";
+    }
+   
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message