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 ke...@apache.org on 2007/07/24 10:14:49 UTC

svn commit: r558957 - /webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java

Author: keithc
Date: Tue Jul 24 01:14:48 2007
New Revision: 558957

URL: http://svn.apache.org/viewvc?view=rev&rev=558957
Log:
Fix for Axis2-3004. This throws an Exception only if there is a fatal error. Else it prints out the warnings and errors. 


Modified:
    webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java

Modified: webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=558957&r1=558956&r2=558957
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/1_3/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Tue Jul 24 01:14:48 2007
@@ -134,15 +134,13 @@
     }
 
     public WSDL20ToAxisServiceBuilder(String wsdlUri,
-                                      String name, String interfaceName) throws Exception {
-        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
-
+                                      String name, String interfaceName) throws WSDLException {
         String fullPath = wsdlUri;
         if (!wsdlUri.startsWith("http://")) {
             File file = new File(wsdlUri);
             fullPath = file.getAbsolutePath();
         }
-        Description description = wsdlReader.readWSDL(fullPath);
+        Description description = readInTheWSDLFile(fullPath);
 
         DescriptionElement descriptionElement = description.toElement();
         savedTargetNamespace = descriptionElement.getTargetNamespace()
@@ -358,7 +356,7 @@
      *
      * @throws AxisFault
      */
-    protected void setup() throws AxisFault {
+    protected void setup() throws AxisFault, WSDLException {
         if (setupComplete) { // already setup, just do nothing and return
             return;
         }
@@ -379,6 +377,8 @@
                     Document document = documentBuilder.parse(in);
 
                     WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
+                    // This turns on WSDL validation which is set off by default.
+                    reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
                     WSDLSource wsdlSource = reader.createWSDLSource();
                     wsdlSource.setSource(document.getDocumentElement());
                     wsdlSource.setBaseURI(new URI(getBaseUri()));
@@ -405,7 +405,10 @@
             setupComplete = true;
         } catch (AxisFault e) {
             throw e; // just rethrow AxisFaults
-        } catch (Exception e) {
+        } catch (WSDLException e) {
+            // Preserve the WSDLException
+            throw e;
+        } catch(Exception e) {
             throw AxisFault.makeFault(e);
         }
     }
@@ -1016,11 +1019,13 @@
         }
     }
 
-    private Description readInTheWSDLFile(String wsdlURI)
-            throws WSDLException {
+    private Description readInTheWSDLFile(String wsdlURI) throws WSDLException {
 
         WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
-        return reader.readWSDL(wsdlURI);
+        // This turns on WSDL validation which is set off by default.
+//        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
+        Description description1 = reader.readWSDL(wsdlURI);
+        return description1;
     }
 
     /**



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