You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/08/06 22:54:23 UTC

svn commit: r563273 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java

Author: dims
Date: Mon Aug  6 13:54:22 2007
New Revision: 563273

URL: http://svn.apache.org/viewvc?view=rev&rev=563273
Log:
Better support for unexploded war - set the resolvers so that the wsdl/xsd's get picked up properly from the aar. found when testing AXIS2-3065

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?view=diff&rev=563273&r1=563272&r2=563273
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Mon Aug  6 13:54:22 2007
@@ -31,6 +31,8 @@
 import org.apache.axis2.deployment.scheduler.Scheduler;
 import org.apache.axis2.deployment.scheduler.SchedulerTask;
 import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator;
+import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
@@ -331,15 +333,24 @@
 
             if (TAG_SERVICE.equals(elementName)) {
                 AxisService axisService = null;
+                String wsdlLocation =  "META-INF/service.wsdl";
                 InputStream wsdlStream =
-                        serviceClassLoader.getResourceAsStream(metainf + "/service.wsdl");
+                        serviceClassLoader.getResourceAsStream(wsdlLocation);
                 if (wsdlStream == null) {
+                    wsdlLocation =  "META-INF/" + serviceName + ".wsdl";
                     wsdlStream = serviceClassLoader
-                            .getResourceAsStream(metainf + "/" + serviceName + ".wsdl");
+                            .getResourceAsStream(wsdlLocation);
                 }
                 if (wsdlStream != null) {
                     WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
                             new WSDL11ToAxisServiceBuilder(wsdlStream, null, null);
+                    File file = Utils.toFile(servicesURL);
+                    if(file != null && file.exists()){
+                        wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
+                                    new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
+                        wsdl2AxisServiceBuilder.setCustomResolver(
+                                new AARFileBasedURIResolver(file));
+                    }
                     axisService = wsdl2AxisServiceBuilder.populateService();
                     axisService.setWsdlFound(true);
                     axisService.setCustomWsdl(true);
@@ -365,26 +376,35 @@
                 Iterator serviceIterator = servicList.iterator();
                 while (serviceIterator.hasNext()) {
                     AxisService axisService = (AxisService) serviceIterator.next();
+                    String wsdlLocation =  "META-INF/service.wsdl";
                     InputStream wsdlStream =
-                            serviceClassLoader.getResourceAsStream(metainf + "/service.wsdl");
+                            serviceClassLoader.getResourceAsStream(wsdlLocation);
                     if (wsdlStream == null) {
+                        wsdlLocation =  "META-INF/" + serviceName + ".wsdl";
                         wsdlStream = serviceClassLoader
-                                .getResourceAsStream(metainf + "/" + serviceName + ".wsdl");
-                        if (wsdlStream != null) {
-                            WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
-                                    new WSDL11ToAxisServiceBuilder(wsdlStream, axisService);
-                            axisService = wsdl2AxisServiceBuilder.populateService();
-                            axisService.setWsdlFound(true);
-                            axisService.setCustomWsdl(true);
-                            // Set the default message receiver for the operations that were
-                            // not listed in the services.xml
-                            Iterator operations = axisService.getOperations();
-                            while (operations.hasNext()) {
-                                AxisOperation operation = (AxisOperation) operations.next();
-                                if (operation.getMessageReceiver() == null) {
-                                    operation.setMessageReceiver(loadDefaultMessageReceiver(
-                                            operation.getMessageExchangePattern(), axisService));
-                                }
+                                .getResourceAsStream(wsdlLocation);
+                    }
+                    if (wsdlStream != null) {
+                        WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
+                                new WSDL11ToAxisServiceBuilder(wsdlStream, axisService);
+                        File file = Utils.toFile(servicesURL);
+                        if(file != null && file.exists()){
+                            wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
+                                        new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
+                            wsdl2AxisServiceBuilder.setCustomResolver(
+                                    new AARFileBasedURIResolver(file));
+                        }
+                        axisService = wsdl2AxisServiceBuilder.populateService();
+                        axisService.setWsdlFound(true);
+                        axisService.setCustomWsdl(true);
+                        // Set the default message receiver for the operations that were
+                        // not listed in the services.xml
+                        Iterator operations = axisService.getOperations();
+                        while (operations.hasNext()) {
+                            AxisOperation operation = (AxisOperation) operations.next();
+                            if (operation.getMessageReceiver() == null) {
+                                operation.setMessageReceiver(loadDefaultMessageReceiver(
+                                        operation.getMessageExchangePattern(), axisService));
                             }
                         }
                     }



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