cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r585206 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/ tools/wsdlt...
Date Tue, 16 Oct 2007 17:52:06 GMT
Author: dkulp
Date: Tue Oct 16 10:51:56 2007
New Revision: 585206

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

........
  r585073 | ema | 2007-10-16 04:12:36 -0400 (Tue, 16 Oct 2007) | 4 lines
  
  * Fixed issue CXF-1112 , add catalog support for wsdlLocation and schemaLocation in binding
file
  * Fixed the jaxb binding file test failure in 2.0.x branch
  * Changed the port number to 9234 in JettyHTTPServerEngineTest to avoid port conflict with
some app
........

Added:
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/
      - copied from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml
      - copied unchanged from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/binding.xml
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml
      - copied unchanged from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/catalog.xml
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd
      - copied unchanged from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/extra.xsd
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml
      - copied unchanged from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml
      - copied unchanged from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/jaxbbinding.xml
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl
      - copied unchanged from r585073, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1112/myservice.wsdl
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java?rev=585206&r1=585205&r2=585206&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
Tue Oct 16 10:51:56 2007
@@ -68,11 +68,11 @@
     @Test
     public void testEngineRetrieval() throws Exception {
         JettyHTTPServerEngine engine = 
-            factory.createJettyHTTPServerEngine(1234, "http");
+            factory.createJettyHTTPServerEngine(9234, "http");
         
         assertTrue(
             "Engine references for the same port should point to the same instance",
-            engine == factory.retrieveJettyHTTPServerEngine(1234));
+            engine == factory.retrieveJettyHTTPServerEngine(9234));
         
         factory.destroyForPort(1234);
     }
@@ -80,13 +80,13 @@
     @Test
     public void testHttpAndHttps() throws Exception {
         JettyHTTPServerEngine engine = 
-            factory.createJettyHTTPServerEngine(1234, "http");
+            factory.createJettyHTTPServerEngine(9234, "http");
         
         assertTrue("Protocol must be http", 
                 "http".equals(engine.getProtocol()));
         
         engine = new JettyHTTPServerEngine();
-        engine.setPort(1235);
+        engine.setPort(9235);
         engine.setTlsServerParameters(new TLSServerParameters());
         engine.finalizeConfig();
         
@@ -94,14 +94,14 @@
         list.add(engine);
         factory.setEnginesList(list);
         
-        engine = factory.createJettyHTTPServerEngine(1235, "https");
+        engine = factory.createJettyHTTPServerEngine(9235, "https");
         
         assertTrue("Protocol must be https", 
                 "https".equals(engine.getProtocol()));
         
         
-        factory.destroyForPort(1234);
-        factory.destroyForPort(1235);
+        factory.destroyForPort(9234);
+        factory.destroyForPort(9235);
     }
     
     
@@ -147,10 +147,10 @@
     
     @Test 
     public void testaddServants() throws Exception {
-        String urlStr = "http://localhost:1234/hello/test";
-        String urlStr2 = "http://localhost:1234/hello233/test";
+        String urlStr = "http://localhost:9234/hello/test";
+        String urlStr2 = "http://localhost:9234/hello233/test";
         JettyHTTPServerEngine engine = 
-            factory.createJettyHTTPServerEngine(1234, "http");
+            factory.createJettyHTTPServerEngine(9234, "http");
         JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1");
         JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2");        
         engine.addServant(new URL(urlStr), handler1);
@@ -179,18 +179,18 @@
         }
         assertEquals("The jetty http handler did not take effect", response, "string2");
         // set the get request
-        factory.destroyForPort(1234);       
+        factory.destroyForPort(9234);       
         
     }
     
     @Test 
     public void testSetHandlers() throws Exception {
-        URL url = new URL("http://localhost:1245/hello/test");
+        URL url = new URL("http://localhost:9235/hello/test");
         JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1");
         JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2");
         
         JettyHTTPServerEngine engine = new JettyHTTPServerEngine();
-        engine.setPort(1245);
+        engine.setPort(9235);
         
         List<Handler> handlers = new ArrayList<Handler>();
         handlers.add(handler1);
@@ -210,9 +210,9 @@
     
     @Test 
     public void testGetContextHandler() throws Exception {
-        String urlStr = "http://localhost:1234/hello/test";
+        String urlStr = "http://localhost:9234/hello/test";
         JettyHTTPServerEngine engine = 
-            factory.createJettyHTTPServerEngine(1234, "http");
+            factory.createJettyHTTPServerEngine(9234, "http");
         ContextHandler contextHandler = engine.getContextHandler(new URL(urlStr));
         // can't find the context handler here
         assertNull(contextHandler);
@@ -231,7 +231,7 @@
             fail("Can't get the reponse from the server " + ex);
         }
         assertEquals("the jetty http handler did not take effect", response, "string2");
-        factory.destroyForPort(1234);
+        factory.destroyForPort(9234);
     }
     
     private String getResponse(String target) throws Exception {

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
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/customization/CustomizationParser.java?rev=585206&r1=585205&r2=585206&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Tue Oct 16 10:51:56 2007
@@ -41,6 +41,8 @@
 
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -55,13 +57,14 @@
 import org.apache.cxf.tools.util.StAXUtil;
 import org.apache.cxf.tools.util.URIParserUtil;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+import org.apache.xml.resolver.Catalog;
 
 public final class CustomizationParser {
     // For WSDL1.1
     private static final Logger LOG = LogUtils.getL7dLogger(CustomizationParser.class);
 
     private ToolContext env;
-    //map for jaxws binding and wsdl element
+    // map for jaxws binding and wsdl element
     private final Map<Element, Element> jaxwsBindingsMap = new HashMap<Element,
Element>();
     private final List<InputSource> jaxbBindings = new ArrayList<InputSource>();
     private final Map<String, Element> customizedElements = new HashMap<String,
Element>();
@@ -86,11 +89,13 @@
         String[] bindingFiles;
         try {
             wsdlURL = URIParserUtil.getAbsoluteURI((String)env.get(ToolConstants.CFG_WSDLURL));
-            try {
-                wsdlNode = getTargetNode(this.wsdlURL);
-            } catch (IOException e) {
-               // do nothing
+
+            wsdlNode = getTargetNode(this.wsdlURL);
+
+            if (wsdlNode == null && env.get(ToolConstants.CFG_CATALOG) != null) {
+                wsdlNode = resolveNodeByCatalog(wsdlURL);
             }
+            // TODO: if wsdlNode is null throw exception
             customizedElements.put(wsdlURL.toString(), wsdlNode);
             bindingFiles = (String[])env.get(ToolConstants.CFG_BINDING);
             if (bindingFiles == null) {
@@ -120,21 +125,25 @@
         buildHandlerChains();
     }
 
-    public Element getTargetNode(String wsdlLoc) throws IOException {
+    public Element getTargetNode(String uri) {
         Document doc = null;
         InputStream ins = null;
+
         try {
-            URIResolver resolver = new URIResolver(wsdlLoc);
+            URIResolver resolver = new URIResolver(uri);
             ins = resolver.getInputStream();
         } catch (IOException e1) {
-            throw e1;
-            
+            return null;
         }
 
+        if (ins == null) {
+            return null;
+        }
+        
         try {
             doc = DOMUtils.readXml(ins);
         } catch (Exception e) {
-            Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[]{wsdlLoc});
+            Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[] {uri});
             throw new ToolException(msg, e);
         }
 
@@ -165,8 +174,7 @@
         Node annotationNode = nodeSelector.queryNode(node, "//xsd:annotation");
 
         if (annotationNode == null) {
-            annotationNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI,
-                                                                     "annotation");
+            annotationNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI,
"annotation");
         }
 
         nodes[0] = annotationNode;
@@ -174,8 +182,7 @@
         Node appinfoNode = nodeSelector.queryNode(annotationNode, "//xsd:appinfo");
 
         if (appinfoNode == null) {
-            appinfoNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI,
-                                                                  "appinfo");
+            appinfoNode = node.getOwnerDocument().createElementNS(ToolConstants.SCHEMA_URI,
"appinfo");
             annotationNode.appendChild(appinfoNode);
         }
         nodes[1] = appinfoNode;
@@ -194,8 +201,7 @@
         Element jaxbBindingElement = getJaxbBindingElement(jaxwsBindingNode);
         appendJaxbVersion((Element)schemaNode);
         if (jaxbBindingElement != null) {
-            NodeList nlist = nodeSelector.queryNodes(schemaNode,
-                                                    jaxbBindingElement.getAttribute("node"));
+            NodeList nlist = nodeSelector.queryNodes(schemaNode, jaxbBindingElement.getAttribute("node"));
             for (int i = 0; i < nlist.getLength(); i++) {
                 Node node = nlist.item(i);
                 copyAllJaxbDeclarations(node, jaxbBindingElement);
@@ -203,7 +209,7 @@
             return;
         }
 
-        Node[] embededNodes  = getAnnotationNodes(schemaNode);
+        Node[] embededNodes = getAnnotationNodes(schemaNode);
         Node annotationNode = embededNodes[0];
         Node appinfoNode = embededNodes[1];
 
@@ -252,8 +258,7 @@
 
             NodeList nodeList = nodeSelector.queryNodes(targetNode, expression);
             if (nodeList == null || nodeList.getLength() == 0) {
-                throw new ToolException(new Message("NODE_NOT_EXISTS",
-                                                    LOG, new Object[] {expression}));
+                throw new ToolException(new Message("NODE_NOT_EXISTS", LOG, new Object[]
{expression}));
             }
 
             for (int i = 0; i < nodeList.getLength(); i++) {
@@ -272,7 +277,7 @@
                 internalizeBinding(children[i], targetNode, expression);
             }
         }
-        
+
     }
 
     private void copyBindingsToWsdl(Node node, Node bindings, MapNamespaceContext ctx) {
@@ -282,8 +287,8 @@
 
         for (Map.Entry<String, String> ent : ctx.getUsedNamespaces().entrySet()) {
             if (node.lookupNamespaceURI(ent.getKey()) == null) {
-                node.getOwnerDocument().getDocumentElement()
-                    .setAttribute("xmlns:" + ent.getKey(), ent.getValue());
+                node.getOwnerDocument().getDocumentElement().setAttribute("xmlns:" + ent.getKey(),
+                                                                          ent.getValue());
             }
 
         }
@@ -322,7 +327,6 @@
                 if (attrNode != null) {
                     cloneNode.removeChild(child);
                 }
-
             }
         }
         firstChild.appendChild(cloneNode);
@@ -378,81 +382,133 @@
             throw new ToolException(msg, e1);
         }
         if (isValidJaxwsBindingFile(bindingFile, reader)) {
-            
+
             String wsdlLocation = root.getAttribute("wsdlLocation");
             Element targetNode = null;
             if (!StringUtils.isEmpty(wsdlLocation)) {
-                URI wsdlURI = null;
-                try {
-                    wsdlURI = new URI(wsdlLocation);
-                } catch (URISyntaxException e) {
-                    Message msg = new Message("JAXWSBINDINGS_WSDLLOC_ERROR",
-                                              LOG, new Object[] {wsdlLocation});
-                    throw new ToolException(msg);
-                } 
-                
-                if (!wsdlURI.isAbsolute()) {
-                    try {
-                        String base = URIParserUtil.getAbsoluteURI(bindingFile);
-                        URI baseURI = new URI(base);
-                        wsdlURI = baseURI.resolve(wsdlURI);
-                    } catch (URISyntaxException e) {
-                        Message msg = new Message("NOT_URI", LOG, new Object[] {bindingFile});
-                        throw new ToolException(msg, e);
-                    }
-
-                }
-                try {
-                    targetNode = this.getTargetNode(wsdlURI.toString());
-                } catch (IOException e) {
-                    Message msg = new Message("POINT_TO_WSDL_DOES_NOT_EXIST", 
-                                              LOG, new Object[]{bindingFile, wsdlURI.toString()});
-                    throw new ToolException(msg, e);
+                String wsdlURI = getAbsoluteURI(wsdlLocation, bindingFile);
+                targetNode = getTargetNode(wsdlURI);
+                String resolvedLoc = wsdlURI;
+                if (targetNode == null && env.get(ToolConstants.CFG_CATALOG) != null)
{
+                    resolvedLoc = resolveByCatalog(wsdlURI.toString());
+                    targetNode = getTargetNode(resolvedLoc);
                 }
                 if (targetNode == null) {
-                    Message msg = new Message("CAN_NOT_FIND_BINDING_WSDL", 
-                                              LOG, new Object[] {wsdlURI.normalize(), bindingFile});
+                    Message msg = new Message("POINT_TO_WSDL_DOES_NOT_EXIST", 
+                                              LOG, new Object[] {bindingFile, resolvedLoc});
                     throw new ToolException(msg);
-                    
                 }
-                root.setAttribute("wsdlLocation", wsdlURI.toString());                
+
+                root.setAttribute("wsdlLocation", wsdlURI);
             } else {
-                try {
-                    targetNode = getTargetNode(wsdlURL);
-                } catch (IOException e) {
-                    //do nothing
-                }
-                root.setAttribute("wsdlLocation", wsdlURL);   
+                targetNode = wsdlNode;
+
+                root.setAttribute("wsdlLocation", wsdlURL);
             }
             jaxwsBindingsMap.put(root, targetNode);
-            
+
         } else if (isValidJaxbBindingFile(reader)) {
             String schemaLocation = root.getAttribute("schemaLocation");
             if (StringUtils.isEmpty(schemaLocation)) {
-                root.setAttribute("schemaLocation", wsdlURL);
+                InputSource tmpIns = null;
                 try {
-                    File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
-                    XMLUtils.writeTo(root, new FileOutputStream(tmpFile));
-                    InputSource newis = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile
-                        .getAbsolutePath()));
-                    jaxbBindings.add(newis);
-                    tmpFile.deleteOnExit();
-                } catch (Exception e) {
+                    tmpIns = convertToTmpInputSource(root, wsdlURL);
+                } catch (Exception e1) {
                     Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG, bindingFile);
-                    throw new ToolException(msg, e);
-                }                
+                    throw new ToolException(msg, e1);
+                }
+                jaxbBindings.add(tmpIns);
             } else {
-                jaxbBindings.add(is);
+                String schemeURI = this.getAbsoluteURI(schemaLocation, bindingFile);
+                Element ele = getTargetNode(schemeURI);
+                if (ele != null) {
+                    jaxbBindings.add(is);
+                } else {
+                    // try to resolve it with CatalogReslover
+                    String resolvedLocation = null;
+                    if (env.get(ToolConstants.CFG_CATALOG) != null) {
+                        resolvedLocation = resolveByCatalog(schemaLocation);
+                    }
+                    if (resolvedLocation == null) {
+                        Message msg = new Message("POINT_TO_XSD_DOES_NOT_EXIST", LOG, schemaLocation);
+                        throw new ToolException(msg);
+                    } else {
+                        InputSource tmpIns = null;
+                        try {
+                            tmpIns = convertToTmpInputSource(root, resolvedLocation);
+                        } catch (Exception e1) {
+                            Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG,
bindingFile);
+                            throw new ToolException(msg, e1);
+                        }
+                        jaxbBindings.add(tmpIns);
+                    }
+                }
             }
+
         } else {
             Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile);
             throw new ToolException(msg);
         }
     }
 
+    private String getAbsoluteURI(String  uri, String bindingFile) {
+        URI locURI = null;
+        try {
+            locURI = new URI(uri);
+        } catch (URISyntaxException e) {
+            Message msg = new Message("BINDING_LOC_ERROR", 
+                                      LOG, new Object[] {uri});
+            throw new ToolException(msg);
+        }
+
+        if (!locURI.isAbsolute()) {
+            try {
+                String base = URIParserUtil.getAbsoluteURI(bindingFile);
+                URI baseURI = new URI(base);
+                locURI = baseURI.resolve(locURI);
+            } catch (URISyntaxException e) {
+                Message msg = new Message("NOT_URI", LOG, new Object[] {bindingFile});
+                throw new ToolException(msg, e);
+            }
+
+        }
+        return locURI.toString();
+    }
+    
+    private Element resolveNodeByCatalog(String url) {
+        String resolvedLocation = resolveByCatalog(url);
+        return getTargetNode(resolvedLocation);
+    }
+
+    private String resolveByCatalog(String url) {
+        Bus bus = (Bus)env.get(Bus.class);
+        Catalog catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
+        String resolvedLocation;
+        try {
+            resolvedLocation = catalogResolver.resolveSystem(url);
+            if (resolvedLocation == null) {
+                resolvedLocation = catalogResolver.resolveURI(url);
+            }
+        } catch (Exception e1) {
+            Message msg = new Message("FAILED_RESOLVE_CATALOG", LOG, url);
+            throw new ToolException(msg, e1);
+        }
+        return resolvedLocation;
+    }
+
+    private InputSource convertToTmpInputSource(Element ele, String schemaLoc) throws Exception
{
+        InputSource result = null;
+        ele.setAttribute("schemaLocation", schemaLoc);
+        File tmpFile = FileUtils.createTempFile("jaxbbinding", ".xml");
+        XMLUtils.writeTo(ele, new FileOutputStream(tmpFile));
+        result = new InputSource(URIParserUtil.getAbsoluteURI(tmpFile.getAbsolutePath()));
+        tmpFile.deleteOnExit();
+        return result;
+    }
+
     private boolean isValidJaxbBindingFile(XMLStreamReader reader) {
         if (ToolConstants.JAXB_BINDINGS.equals(reader.getName())) {
-            
+
             return true;
         }
         return false;
@@ -460,12 +516,13 @@
 
     private boolean isValidJaxwsBindingFile(String bindingLocation, XMLStreamReader reader)
{
         if (ToolConstants.JAXWS_BINDINGS.equals(reader.getName())) {
-            //Comment this check , by default wsdlLocation value will be the user input wsdl
url
+            // Comment this check , by default wsdlLocation value will be the
+            // user input wsdl url
             /*
-             String wsdlLocation = reader.getAttributeValue(null, "wsdlLocation");
-            if (!StringUtils.isEmpty(wsdlLocation)) {
-                return true;
-            }*/
+             * String wsdlLocation = reader.getAttributeValue(null,
+             * "wsdlLocation"); if (!StringUtils.isEmpty(wsdlLocation)) { return
+             * true; }
+             */
             return true;
         }
         return false;
@@ -475,6 +532,7 @@
     protected void setWSDLNode(final Element node) {
         this.wsdlNode = node;
     }
+
     public Node getWSDLNode() {
         return this.wsdlNode;
     }
@@ -495,7 +553,7 @@
     protected Element getJaxbBindingElement(final Element bindings) {
         NodeList list = bindings.getElementsByTagNameNS(ToolConstants.NS_JAXB_BINDINGS, "bindings");
         if (list.getLength() > 0) {
-            return (Element) list.item(0);
+            return (Element)list.item(0);
         }
         return null;
     }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
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/customization/Messages.properties?rev=585206&r1=585205&r2=585206&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
Tue Oct 16 10:51:56 2007
@@ -21,11 +21,13 @@
 STAX_PARSER_ERROR = StAX parser error, check your external binding file(s)
 UNKNOWN_BINDING_FILE= Unknown external binding files : {0}
 CAN_NOT_FIND_BINDING_WSDL = Can not read the specified wsdl {0} that external binding file
{1} points to
-JAXWSBINDINGS_WSDLLOC_ERROR = Attribute wsdlLocation value {0} in jaxws binding element is
not an URI
+BINDING_LOC_ERROR = Attribute wsdlLocation/schemaLocation value {0} in jaxws binding element
is not an URI
 ERROR_TARGETNODE_WITH_XPATH = XPath query {0} is identifying either multiple or no target
nodes.
 XPATH_ERROR = XPath query error , check the query expression : {0}
 NOT_URI = Can not construct new URI with this string : {0}
-CAN_NOT_READ_AS_ELEMENT = Can not read this file to a xml element : {0}
+CAN_NOT_READ_AS_ELEMENT = The binding file : {0} references to a not well-formed xml doucument

 NODE_NOT_EXISTS = Can not find any node with the XPath {0}
 FAILED_TO_ADD_SCHEMALOCATION = Failed to inject schmeaLoaction for binding file {0}
-POINT_TO_WSDL_DOES_NOT_EXIST  = Binding file : {0} points to wsdl(resovled as {1}) does not
exist 
\ No newline at end of file
+POINT_TO_WSDL_DOES_NOT_EXIST  = Binding file : {0} points to wsdl(resovled as {1}) does not
exist
+POINT_TO_XSD_DOES_NOT_EXIST  = Binding file : {0} points to xsd(resovled as {1}) does not
exist
+FAILED_RESOLVE_CATALOG = Failed to resolve catalog {0} 
\ No newline at end of file

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
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/wsdl11/JAXWSDefinitionBuilder.java?rev=585206&r1=585205&r2=585206&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Tue Oct 16 10:51:56 2007
@@ -40,6 +40,7 @@
 
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -84,6 +85,7 @@
     public Definition build(String wsdlURL) {
         this.builder.setBus(this.bus);
         wsdlDefinition = builder.build(wsdlURL);
+        context.put(Bus.class, bus);
         context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
         checkSupported(wsdlDefinition);
         return wsdlDefinition;

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=585206&r1=585205&r2=585206&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Oct 16 10:51:56 2007
@@ -328,6 +328,7 @@
                                           output.getCanonicalPath() + "/classes", "-d",
                                           output.getCanonicalPath(), "-b",
                                           getLocation("/wsdl2java_wsdl/bug305924/binding1.xml"),
+                                          "-verbose",
                                           getLocation("/wsdl2java_wsdl/bug305924/hello_world.wsdl")};
             WSDLToJava.main(args);
         } catch (Exception e) {
@@ -815,5 +816,27 @@
         }
         assertFalse("sayHiAsyn method should not be generated", existSayHiAsyn);
     }
+    
+    
+    @Test
+    public void testCatalog() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/cxf1112/myservice.wsdl"));
+        env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/catalog.xml"));
+        env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/jaxbbinding.xml"));
+        processor.setContext(env);
+        processor.execute();
+    }
+    
+    
+    @Test
+    public void testCatalog2() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, "http://example.org/wsdl");
+        env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf1112/jax-ws-catalog.xml"));
+        env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1112/binding.xml"));
+        processor.setContext(env);
+        processor.execute();
+    }
+    
     
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml?rev=585206&r1=585205&r2=585206&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1094/jaxbbinding.xml
Tue Oct 16 10:51:56 2007
@@ -20,7 +20,7 @@
 <jaxb:bindings version="2.0"
       xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-      node="xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence/xsd:element[@name='MyProcess']/xsd:simpleType">
+      node="//xsd:element[@name='CreateProcess']/xsd:complexType/xsd:sequence/xsd:element[@name='MyProcess']/xsd:simpleType">
 		<jaxb:typesafeEnumClass name="MyProcess">
 			<jaxb:typesafeEnumMember name="BLUE" value="BLUE" />
 			<jaxb:typesafeEnumMember name="RED" value="RED" />



Mime
View raw message