cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r637173 - in /incubator/cxf/trunk/tools/wsdlto: core/src/main/java/org/apache/cxf/tools/wsdlto/ frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/
Date Fri, 14 Mar 2008 17:35:00 GMT
Author: dkulp
Date: Fri Mar 14 10:34:54 2008
New Revision: 637173

URL: http://svn.apache.org/viewvc?rev=637173&view=rev
Log:
Fix generated code to use wsdlLocation whenever it can
If wsdlLocation is not specified, use the location of the passed wsdl, but don't make it absolute
Fix generated client to NOT require wsdl location as an arguement.   The service has it burned
in already. Use it.

Modified:
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=637173&r1=637172&r2=637173&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Fri Mar 14 10:34:54 2008
@@ -22,6 +22,8 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -373,6 +375,31 @@
         }
 
         env.put(ToolConstants.CFG_WSDLURL, URIParserUtil.normalize(wsdl));
+        if (!env.containsKey(ToolConstants.CFG_WSDLLOCATION)) {
+            //make sure the "raw" form is used for the wsdlLocation
+            //instead of the absolute URI that normalize may return
+            try {
+                URL url = new URL(wsdl);
+                wsdl = url.toString();
+            } catch (MalformedURLException e) {
+                //not a URL, assume file
+                if (wsdl.indexOf(":") != -1 && !wsdl.startsWith("/")) {
+                    wsdl = "file:/" + wsdl;
+                } else {
+                    wsdl = "file:" + wsdl;
+                }
+                try {
+                    URL url = new URL(wsdl);
+                    wsdl = url.toString();
+                } catch (MalformedURLException e1) {
+                    //ignore... 
+                }
+            }
+            wsdl = wsdl.replace("\\", "/");
+
+            env.put(ToolConstants.CFG_WSDLLOCATION, wsdl);
+        }
+        
 
         String[] bindingFiles;
         try {

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm?rev=637173&r1=637172&r2=637173&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
Fri Mar 14 10:34:54 2008
@@ -48,21 +48,18 @@
     }
 
     public static void main(String args[]) throws Exception {
-
-        if (args.length == 0) { 
-            System.out.println("please specify wsdl");
-            System.exit(1); 
-        }
-        URL wsdlURL = null;
-        File wsdlFile = new File(args[0]);
-        try {
-            if (wsdlFile.exists()) {
-                wsdlURL = wsdlFile.toURI().toURL();
-            } else {
-                wsdlURL = new URL(args[0]);
+        URL wsdlURL = ${service.Name}.WSDL_LOCATION;
+        if (args.length > 0) { 
+            File wsdlFile = new File(args[0]);
+            try {
+                if (wsdlFile.exists()) {
+                    wsdlURL = wsdlFile.toURI().toURL();
+                } else {
+                    wsdlURL = new URL(args[0]);
+                }
+            } catch (MalformedURLException e) {
+                e.printStackTrace();
             }
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
         }
       
         $service.Name ss = new ${service.Name}(wsdlURL, SERVICE_NAME);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm?rev=637173&r1=637172&r2=637173&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
Fri Mar 14 10:34:54 2008
@@ -34,11 +34,12 @@
  * 
  */
 
-@javax.jws.WebService(name = "$intf.Name", serviceName = "$service.ServiceName",
+@javax.jws.WebService(name = "$intf.Name",
+                      serviceName = "$service.ServiceName",
                       portName = "$port",
                       targetNamespace = "$service.Namespace", 
-                      wsdlLocation = "$intf.Location" ,
-		      endpointInterface = "$intf.PackageName.$intf.Name")
+                      wsdlLocation = "$intf.Location",
+                      endpointInterface = "$intf.PackageName.$intf.Name")
                       
 public class ${intf.Name}Impl implements $intf.Name {
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?rev=637173&r1=637172&r2=637173&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
Fri Mar 14 10:34:54 2008
@@ -49,9 +49,9 @@
     static {
         URL url = null;
         try {
-            url = new URL("$wsdlUrl");
+            url = new URL("$wsdlLocation");
         } catch (MalformedURLException e) {
-            System.err.println("Can not initialize the default wsdl from $wsdlUrl");
+            System.err.println("Can not initialize the default wsdl from $wsdlLocation");
             // e.printStackTrace();
         }
         WSDL_LOCATION = url;



Mime
View raw message