Author: dkulp
Date: Fri Mar 14 11:00:14 2008
New Revision: 637186

URL: http://svn.apache.org/viewvc?rev=637186&view=rev
Log:
Merged revisions 637173 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r637173 | dkulp | 2008-03-14 13:34:54 -0400 (Fri, 14 Mar 2008) | 4 lines
  
  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/branches/2.0.x-fixes/   (props changed)
    
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
    
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
    
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=637186&r1=637185&r2=637186&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
 Fri Mar 14 11:00:14 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;
@@ -365,6 +367,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/branches/2.0.x-fixes/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/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm?rev=637186&r1=637185&r2=637186&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
 Fri Mar 14 11:00:14 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/branches/2.0.x-fixes/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/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm?rev=637186&r1=637185&r2=637186&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/impl.vm
 Fri Mar 14 11:00:14 2008
@@ -34,11 +34,12 @@
  * 
  */
 
[EMAIL PROTECTED](name = "$intf.Name", serviceName = "$service.ServiceName",
[EMAIL PROTECTED](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/branches/2.0.x-fixes/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/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?rev=637186&r1=637185&r2=637186&view=diff
==============================================================================
--- 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
 (original)
+++ 
incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
 Fri Mar 14 11:00:14 2008
@@ -51,9 +51,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;


Reply via email to