axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r415276 - in /webservices/axis2/trunk/java/modules: common/src/org/apache/axis2/i18n/ common/src/org/apache/axis2/wsdl/ core/src/org/apache/axis2/deployment/repository/util/ core/src/org/apache/axis2/description/
Date Mon, 19 Jun 2006 10:14:14 GMT
Author: chinthaka
Date: Mon Jun 19 03:14:13 2006
New Revision: 415276

URL: http://svn.apache.org/viewvc?rev=415276&view=rev
Log:
Improved the deployment to get wsdl 2.0 document as the wsdl of a service archive

Modified:
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDL20Constants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties?rev=415276&r1=415275&r2=415276&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
(original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
Mon Jun 19 03:14:13 2006
@@ -81,6 +81,8 @@
 invalidserviceinagroup=Invalid service {0} not belong to service group {1}
 
 #     Deployment Errors
+invalidWSDLFound=Invalid WSDL found in the service archive file. WSDL File must have either
\
+  http://www.w3.org/2006/01/wsdl or http://www.w3.org/2004/03/wsdl as the namespace of the
document element.
 wsdlfilenotfound=WSDL file not found for the service :   {0}
 servicexmlnotfound=services.xml not found for service ''{0}''
 modulexmlnotfound=module.xml not found  for the module :   {0}

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDL20Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDL20Constants.java?rev=415276&r1=415275&r2=415276&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDL20Constants.java
(original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDL20Constants.java
Mon Jun 19 03:14:13 2006
@@ -40,5 +40,7 @@
     // http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#out-opt-in
     public static final String MEP_URI_OUT_OPTIONAL_IN = "http://www.w3.org/2006/01/wsdl/out-opt-in";
 
+    public static final String DEFAULT_NAMESPACE_URI = "http://www.w3.org/2006/01/wsdl";
+
 
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=415276&r1=415275&r2=415276&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
Mon Jun 19 03:14:13 2006
@@ -18,7 +18,11 @@
 package org.apache.axis2.deployment.repository.util;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.namespace.Constants;
+import org.apache.axis2.wsdl.WSDL20Constants;
 import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.deployment.DeploymentErrorMsgs;
@@ -33,6 +37,8 @@
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDLToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.commons.logging.Log;
@@ -53,7 +59,7 @@
 import java.util.zip.ZipInputStream;
 
 public class ArchiveReader implements DeploymentConstants {
-	private static final Log log = LogFactory.getLog(ArchiveReader.class);
+    private static final Log log = LogFactory.getLog(ArchiveReader.class);
 
     private ArrayList buildServiceGroup(InputStream zin, DeploymentEngine engine,
                                         AxisServiceGroup axisServiceGroup, HashMap wsdlServices,
@@ -185,24 +191,25 @@
      * @return Returns AxisService.
      * @throws DeploymentException
      */
-    private AxisService processWSDLFile(InputStream in, File serviceArchiveFile,
-                                        boolean isArchive) throws DeploymentException {
+    private AxisService processWSDLFile(WSDLToAxisServiceBuilder axisServiceBuilder, File
serviceArchiveFile,
+                                        boolean isArchive, InputStream in) throws DeploymentException
{
         try {
-            WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
-                    new WSDL11ToAxisServiceBuilder(in, null, null);
+
             if (serviceArchiveFile != null && isArchive) {
-                wsdl2AxisServiceBuilder.setCustomResolver(
+                axisServiceBuilder.setCustomResolver(
                         new AARFileBasedURIResolver(serviceArchiveFile));
-                wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
-                        new AARBasedWSDLLocator(serviceArchiveFile, in)
-                );
+                if (axisServiceBuilder instanceof WSDL11ToAxisServiceBuilder) {
+
+                    ((WSDL11ToAxisServiceBuilder) axisServiceBuilder).setCustomWSLD4JResolver(
+                            new AARBasedWSDLLocator(serviceArchiveFile, in));
+                }
             } else {
                 if (serviceArchiveFile != null) {
-                    wsdl2AxisServiceBuilder.setBaseUri(
+                    axisServiceBuilder.setBaseUri(
                             serviceArchiveFile.getParentFile().getAbsolutePath());
                 }
             }
-            return wsdl2AxisServiceBuilder.populateService();
+            return axisServiceBuilder.populateService();
         } catch (AxisFault axisFault) {
             throw new DeploymentException(axisFault);
         }
@@ -235,9 +242,30 @@
                     File file1 = files[i];
                     if (file1.getName().toLowerCase().endsWith(SUFFIX_WSDL)) {
                         InputStream in = new FileInputStream(file1);
-                        AxisService service = processWSDLFile(in, file1, false);
 
-                        servicesMap.put(service.getName(), service);
+                        // now the question is which version of WSDL file this archive contains.
+                        // lets check the namespace of the root element and decide. But since
we are
+                        // using axiom (dude, you are becoming handy here :)), we will not
build the
+                        // whole thing.
+                        OMNamespace documentElementNS = new StAXOMBuilder(in).getDocumentElement().getNamespace();
+                        if (documentElementNS != null) {
+                            WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
+                            if (WSDL20Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getName()))
+                            {
+                                // we have a WSDL 2.0 document here.
+                                wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(new
FileInputStream(file1), null, null);
+
+                            } else if (Constants.NS_URI_WSDL11.
+                                    equals(documentElementNS.getName())) {
+                                wsdlToAxisServiceBuilder = new WSDL11ToAxisServiceBuilder(new
FileInputStream(file1), null, null);
+                            } else {
+                                new DeploymentException(Messages.getMessage("invalidWSDLFound"));
+                            }
+
+                            AxisService service = processWSDLFile(wsdlToAxisServiceBuilder,
file1, false, new FileInputStream(file1));
+                            servicesMap.put(service.getName(), service);
+                        }
+
                         try {
                             in.close();
                         } catch (IOException e) {
@@ -249,6 +277,8 @@
                 throw new DeploymentException(e);
             } catch (IOException e) {
                 throw new DeploymentException(e);
+            } catch (XMLStreamException e) {
+                throw new DeploymentException(e);
             }
         } else {
             ZipInputStream zin;
@@ -271,8 +301,31 @@
                         }
 
                         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-                        AxisService service = processWSDLFile(in, serviceFile, true);
-                        servicesMap.put(service.getName(), service);
+
+                        // now the question is which version of WSDL file this archive contains.
+                        // lets check the namespace of the root element and decide. But since
we are
+                        // using axiom (dude, you are becoming handy here :)), we will not
build the
+                        // whole thing.
+                        OMNamespace documentElementNS = new StAXOMBuilder(in).getDocumentElement().getNamespace();
+                        if (documentElementNS != null) {
+                            WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
+                            if (WSDL20Constants.DEFAULT_NAMESPACE_URI.equals(documentElementNS.getName()))
+                            {
+                                // we have a WSDL 2.0 document here.
+                                wsdlToAxisServiceBuilder = new WSDL20ToAxisServiceBuilder(new
ByteArrayInputStream(out.toByteArray()), null, null);
+
+                            } else if (Constants.NS_URI_WSDL11.
+                                    equals(documentElementNS.getName())) {
+                                wsdlToAxisServiceBuilder = new WSDL11ToAxisServiceBuilder(new
ByteArrayInputStream(out.toByteArray()), null, null);
+                            } else {
+                                new DeploymentException(Messages.getMessage("invalidWSDLFound"));
+                            }
+
+                            AxisService service = processWSDLFile(wsdlToAxisServiceBuilder,
serviceFile, true, new ByteArrayInputStream(out.toByteArray()));
+                            servicesMap.put(service.getName(), service);
+                        }
+
+
                     }
                 }
                 try {
@@ -283,6 +336,8 @@
             } catch (FileNotFoundException e) {
                 throw new DeploymentException(e);
             } catch (IOException e) {
+                throw new DeploymentException(e);
+            } catch (XMLStreamException e) {
                 throw new DeploymentException(e);
             }
         }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java?rev=415276&r1=415275&r2=415276&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
Mon Jun 19 03:14:13 2006
@@ -1,6 +1,7 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.namespace.Constants;
+import org.apache.axis2.AxisFault;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.resolver.URIResolver;
@@ -160,6 +161,8 @@
         }
         return xsdPrefix;
     }
+
+    public abstract AxisService populateService() throws AxisFault;
 
     /**
      * Utility method that returns a DOM Builder



---------------------------------------------------------------------
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