You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2007/04/06 09:18:23 UTC
svn commit: r526080 - in /incubator/cxf/trunk/tools/wsdlto:
frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/
frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/
test/ test/src/test/java/org/apac...
Author: ema
Date: Fri Apr 6 00:18:22 2007
New Revision: 526080
URL: http://svn.apache.org/viewvc?view=rev&rev=526080
Log:
Fixed issue CXF-338
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd (with props)
Modified:
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/Messages.properties
incubator/cxf/trunk/tools/wsdlto/test/pom.xml
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java?view=diff&rev=526080&r1=526079&r2=526080
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/JAXWSContainer.java Fri Apr 6 00:18:22 2007
@@ -19,12 +19,13 @@
package org.apache.cxf.tools.wsdlto.frontend.jaxws;
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.resource.URIResolver;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolContext;
@@ -50,27 +51,17 @@
public void validate(ToolContext env) throws ToolException {
super.validate(env);
- File tmpfile = new File("");
if (env.containsKey(ToolConstants.CFG_BINDING)) {
String[] bindings = (String[])env.get(ToolConstants.CFG_BINDING);
- for (int i = 0; i < bindings.length; i++) {
-
- File bindingFile = null;
+ URIResolver resolver = null;
+ for (int i = 0; i < bindings.length; i++) {
try {
- URI bindingURI = new URI(bindings[i]);
- if (!bindingURI.isAbsolute()) {
- bindingURI = tmpfile.toURI().resolve(bindingURI);
- }
- bindingFile = new File(bindingURI);
- } catch (URISyntaxException e) {
- bindingFile = new File(bindings[i]);
+ resolver = new URIResolver(bindings[i]);
+ } catch (IOException ioe) {
+ throw new ToolException(ioe);
}
- bindings[i] = bindingFile.toURI().toString();
- if (!bindingFile.exists()) {
+ if (!resolver.isResolved()) {
Message msg = new Message("FILE_NOT_EXIST", LOG, bindings[i]);
- throw new ToolException(msg);
- } else if (bindingFile.isDirectory()) {
- Message msg = new Message("NOT_A_FILE", LOG, bindings[i]);
throw new ToolException(msg);
}
}
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java?view=diff&rev=526080&r1=526079&r2=526080
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/CustomizationParser.java Fri Apr 6 00:18:22 2007
@@ -18,9 +18,7 @@
*/
package org.apache.cxf.tools.wsdlto.frontend.jaxws.customiztion;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
@@ -50,6 +48,7 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.resource.URIResolver;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolContext;
import org.apache.cxf.tools.common.ToolException;
@@ -113,26 +112,18 @@
public Element getTargetNode(String wsdlLoc) {
Document doc = null;
- URI uri = null;
+ InputStream ins = null;
try {
- uri = new URI(wsdlLoc);
- } catch (URISyntaxException e1) {
- // ignore
+ URIResolver resolver = new URIResolver(wsdlLoc);
+ ins = resolver.getInputStream();
+ } catch (IOException e1) {
+ throw new ToolException(e1);
}
- File file = new File(uri);
- InputStream ins;
-
- try {
- ins = new FileInputStream(file);
- } catch (FileNotFoundException e) {
- Message msg = new Message("FILE_NOT_FOUND", LOG, new Object[] {file});
- throw new ToolException(msg, e);
- }
-
+
try {
doc = DOMUtils.readXml(ins);
} catch (Exception e) {
- Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[] {file});
+ Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[] {wsdlLoc});
throw new ToolException(msg, e);
}
@@ -376,12 +367,10 @@
StAXUtil.toStartTag(reader);
if (isValidJaxwsBindingFile(bindingFile, reader)) {
- InputStream inputStream;
Element root = null;
try {
- URI uri = new URI(bindingFile);
- inputStream = new FileInputStream(new File(uri));
- root = DOMUtils.readXml(inputStream).getDocumentElement();
+ URIResolver resolver = new URIResolver(bindingFile);
+ root = DOMUtils.readXml(resolver.getInputStream()).getDocumentElement();
} catch (Exception e1) {
Message msg = new Message("CAN_NOT_READ_AS_ELEMENT", LOG, new Object[] {bindingFile});
throw new ToolException(msg, e1);
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/Messages.properties?view=diff&rev=526080&r1=526079&r2=526080
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/Messages.properties (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customiztion/Messages.properties Fri Apr 6 00:18:22 2007
@@ -30,5 +30,7 @@
NOT_URI = Can not construct new URI with this string : {0}
FILE_NOT_FOUND = Can not found the file : {0}
CAN_NOT_READ_AS_ELEMENT = Can not read this file to a xml element : {0}
+WSDL_HASNOCONTENT = Can not read content from the wsdl : {0}
+
Modified: incubator/cxf/trunk/tools/wsdlto/test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/pom.xml?view=diff&rev=526080&r1=526079&r2=526080
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/pom.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/pom.xml Fri Apr 6 00:18:22 2007
@@ -61,6 +61,15 @@
<artifactId>cxf-tools-wsdlto-frontend-jaxws</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.2rc0</version>
+ <scope>test</scope>
+ </dependency>
+
+
</dependencies>
<scm>
Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?view=diff&rev=526080&r1=526079&r2=526080
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Fri Apr 6 00:18:22 2007
@@ -35,6 +35,8 @@
import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
import org.apache.cxf.tools.wsdlto.core.PluginLoader;
import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.ResourceHandler;
public class CodeGenBugTest extends ProcessorTestBase {
@@ -386,5 +388,25 @@
File address = new File(ws, "addressing");
assertTrue(address.exists());
}
+
+ public void testHelloWorldExternalBindingFile() throws Exception {
+ Server server = new Server(8585);
+ ResourceHandler reshandler = new ResourceHandler();
+ reshandler.setResourceBase(getLocation("/wsdl2java_wsdl/"));
+ server.addHandler(reshandler);
+ server.start();
+ env.put(ToolConstants.CFG_WSDLURL, "http://localhost:8585/hello_world.wsdl");
+ env.put(ToolConstants.CFG_BINDING, "http://localhost:8585/remote-hello_world_binding.xsd");
+ processor.setContext(env);
+ processor.execute();
+ server.stop();
+
+
+
+ }
+
+
+
+
}
Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd?view=auto&rev=526080
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd Fri Apr 6 00:18:22 2007
@@ -0,0 +1,27 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<bindings
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ wsdlLocation="http://localhost:8585/hello_world.wsdl"
+ xmlns="http://java.sun.com/xml/ns/jaxws">
+ <bindings node="wsdl:definitions">
+ <enableAsyncMapping>true</enableAsyncMapping>
+ </bindings>
+</bindings>
\ No newline at end of file
Propchange: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/remote-hello_world_binding.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml