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 de...@apache.org on 2005/06/21 07:40:15 UTC

svn commit: r191625 - in /webservices/axis/trunk/java/modules/core: src/org/apache/axis/deployment/ src/org/apache/axis/deployment/repository/utill/ test-resources/deployment/outservice/ test/org/apache/axis/deployment/

Author: deepal
Date: Mon Jun 20 22:40:14 2005
New Revision: 191625

URL: http://svn.apache.org/viewcvs?rev=191625&view=rev
Log:
if service archive file contains a service.wsdl then the service will be generated using that else only form service.xml the service will be generated

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/ArchiveReader.java
    webservices/axis/trunk/java/modules/core/test-resources/deployment/outservice/build.xml
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java?rev=191625&r1=191624&r2=191625&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java Mon Jun 20 22:40:14 2005
@@ -546,7 +546,8 @@
                 switch (type) {
                     case SERVICE:
                         try {
-                            ServiceDescription service = archiveReader.createService(currentArchiveFile.getAbsolutePath());
+                            //ServiceDescription service = archiveReader.createService(currentArchiveFile.getAbsolutePath());
+                            ServiceDescription service = archiveReader.createService(currentArchiveFile);
                             archiveReader.readServiceArchive(currentArchiveFile.getAbsolutePath(), this, service);
                             addnewService(service);
                             log.info("Deployement WS Name  " + currentArchiveFile.getName());

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/ArchiveReader.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/ArchiveReader.java?rev=191625&r1=191624&r2=191625&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/ArchiveReader.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/ArchiveReader.java Mon Jun 20 22:40:14 2005
@@ -23,44 +23,75 @@
 import org.apache.axis.description.AxisDescWSDLComponentFactory;
 import org.apache.axis.description.ModuleDescription;
 import org.apache.axis.description.ServiceDescription;
-import org.apache.axis.wsdl.builder.wsdl4j.WSDL1ToWOMBuilder;
+import org.apache.axis.wsdl.builder.WOMBuilderFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.wsdl.WSDLDescription;
 
+import javax.wsdl.WSDLException;
 import java.io.*;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
-import java.util.jar.JarInputStream;
+import java.util.Iterator;
 
 public class ArchiveReader implements DeploymentConstants {
 
     private Log log = LogFactory.getLog(getClass());
 
-    public ServiceDescription createService(String filename) throws DeploymentException {
-        WSDL1ToWOMBuilder builder = new WSDL1ToWOMBuilder();
-        String strArchive = filename;
-        ZipInputStream zin;
-        boolean foundwsdl = false;
+//    public ServiceDescription createService(String filename) throws DeploymentException {
+//        String strArchive = filename;
+//        ZipInputStream zin;
+//        boolean foundwsdl = false;
+//        ServiceDescription service = null;
+//        try {
+//            zin = new ZipInputStream(new FileInputStream(strArchive));
+//            ZipEntry entry;
+//            while ((entry = zin.getNextEntry()) != null) {
+//                if (entry.getName().equals(SERVICEWSDL)) {
+//                    WSDLDescription      womDescription = WOMBuilderFactory.getBuilder(
+//                            WOMBuilderFactory.WSDL11).build(zin, new AxisDescWSDLComponentFactory());
+//                    service = (ServiceDescription )womDescription ;
+//                    foundwsdl = true;
+//                    break;
+//                }
+//            }
+//            zin.close();
+//            if (!foundwsdl) {
+//                service = new ServiceDescription();
+//                log.info("WSDL file not found for the service :  " + filename);
+//            }
+//        } catch (Exception e) {
+//            throw new DeploymentException(e);
+//        }
+//        return service;
+//    }
+
+    public ServiceDescription createService(ArchiveFileData file) throws DeploymentException {
         ServiceDescription service = null;
+        InputStream in= file.getClassLoader().getResourceAsStream(SERVICEWSDL);
+        boolean foundservice = false;
         try {
-            zin = new ZipInputStream(new FileInputStream(strArchive));
-            ZipEntry entry;
-            while ((entry = zin.getNextEntry()) != null) {
-                if (entry.getName().equals(SERVICEWSDL)) {
-                    service = (ServiceDescription) builder.build(zin, new AxisDescWSDLComponentFactory());
-                    foundwsdl = true;
-                    break;
+            if(in!= null){
+                WSDLDescription  womDescription = WOMBuilderFactory.getBuilder(
+                        WOMBuilderFactory.WSDL11).build(in, new AxisDescWSDLComponentFactory());
+                Iterator iterator = womDescription.getServices().keySet().iterator();
+                if(iterator.hasNext()){
+                    foundservice = true;
+                    service = (ServiceDescription)iterator.next();
                 }
-            }
-            zin.close();
-            if (!foundwsdl) {
+                if(!foundservice){
+                    service = new ServiceDescription();
+                }
+                in.close();
+            } else {
                 service = new ServiceDescription();
-                log.info("WSDL file not found for the service :  " + filename);
+                log.info("WSDL file not found for the service :  " + file.getName());
             }
         } catch (Exception e) {
             throw new DeploymentException(e);
         }
+
         return service;
     }
 
@@ -93,7 +124,7 @@
                 throw new DeploymentException("service.xml not found");
             }
         } catch (Exception e) {
-            throw new DeploymentException(e.getMessage());
+            throw new DeploymentException(e);
         }
     }
 

Modified: webservices/axis/trunk/java/modules/core/test-resources/deployment/outservice/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test-resources/deployment/outservice/build.xml?rev=191625&r1=191624&r2=191625&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test-resources/deployment/outservice/build.xml (original)
+++ webservices/axis/trunk/java/modules/core/test-resources/deployment/outservice/build.xml Mon Jun 20 22:40:14 2005
@@ -26,6 +26,7 @@
        <copy todir="${build.classes}/META-INF">
 			<fileset dir="${basedir}/META-INF/">
 			<include name="**/*.xml"/>
+			<include name="**/*.wsdl"/>
 			<exclude name="build.xml"/>
 			</fileset>
 		</copy>

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java?rev=191625&r1=191624&r2=191625&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java Mon Jun 20 22:40:14 2005
@@ -29,7 +29,6 @@
 
     public void testparseService1() throws PhaseException, DeploymentException, AxisFault, XMLStreamException {
         String filename = "./target/test-resources/deployment";
-
         ConfigurationContextFactory builder = new ConfigurationContextFactory();
         er = builder.buildEngineContext(filename).getAxisConfiguration();
     }