Repository: cxf Updated Branches: refs/heads/master e28d25804 -> ce2c3121e
[CXF-6580] wsdl2java - Issue with import to default namespace Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ce2c3121 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ce2c3121 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ce2c3121 Branch: refs/heads/master Commit: ce2c3121e15f3b25d69a75637a6df21ad4d748a7 Parents: e28d258 Author: Akitoshi Yoshida <a...@apache.org> Authored: Wed Sep 9 10:57:57 2015 +0200 Committer: Akitoshi Yoshida <a...@apache.org> Committed: Wed Sep 9 10:58:24 2015 +0200 ---------------------------------------------------------------------- .../databinding/jaxb/JAXBDataBinding.java | 4 +- .../cxf/tools/wsdlto/jaxws/CodeGenTest.java | 13 +++ .../wsdl2java_wsdl/cxf6580/catalog.xml | 24 ++++++ .../wsdl2java_wsdl/cxf6580/hello_default.xsd | 28 +++++++ .../wsdl2java_wsdl/cxf6580/hello_import.wsdl | 83 ++++++++++++++++++++ .../wsdl2java_wsdl/cxf6580/hello_types2.xsd | 27 +++++++ 6 files changed, 177 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/ce2c3121/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java ---------------------------------------------------------------------- diff --git a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java index d06e92a..8daf996 100644 --- a/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java +++ b/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java @@ -672,8 +672,8 @@ public class JAXBDataBinding implements DataBindingProfile { continue; } String key = schema.getSourceURI(); - String tns = schema.getTargetNamespace(); - if (ids.contains(key) || tns == null) { + // accepting also a null tns (e.g., reported by apache.ws.xmlschema for no-namespace) + if (ids.contains(key)) { continue; } if (key.startsWith("file:") || key.startsWith("jar:")) { http://git-wip-us.apache.org/repos/asf/cxf/blob/ce2c3121/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java ---------------------------------------------------------------------- diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java index 0575079..c4500cd 100644 --- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java +++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java @@ -1588,6 +1588,19 @@ public class CodeGenTest extends AbstractCodeGenTest { assertEquals(Exception.class, fault.getSuperclass()); } @Test + public void testNoTargetNamespaceSchema() throws Exception { + env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf6580/hello_import.wsdl")); + env.put(ToolConstants.CFG_CATALOG, getLocation("/wsdl2java_wsdl/cxf6580/catalog.xml")); + + processor.setContext(env); + processor.execute(); + + File helloFile = new File(output, "org/apache/hello_soap_http/types/Hello.java"); + assertTrue(helloFile.exists()); + helloFile = new File(output, "org/apache/hello_soap_http/types/HelloResponse.java"); + assertTrue(helloFile.exists()); + } + @Test public void testExceptionSuper() throws Exception { env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world.wsdl")); env.put(ToolConstants.CFG_EXCEPTION_SUPER, "java.lang.RuntimeException"); http://git-wip-us.apache.org/repos/asf/cxf/blob/ce2c3121/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/catalog.xml ---------------------------------------------------------------------- diff --git a/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/catalog.xml b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/catalog.xml new file mode 100644 index 0000000..609a158 --- /dev/null +++ b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/catalog.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- + 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. +--> +<!DOCTYPE catalog PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"> + <rewriteURI rewritePrefix="hello_types2.xsd" uriStartString="http://apache.org/hello_soap_http/hello_types2.xsd"/> + <rewriteURI rewritePrefix="hello_default.xsd" uriStartString="http://apache.org/hello_soap_http/hello_default.xsd"/> +</catalog> http://git-wip-us.apache.org/repos/asf/cxf/blob/ce2c3121/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_default.xsd ---------------------------------------------------------------------- diff --git a/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_default.xsd b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_default.xsd new file mode 100644 index 0000000..577bfa7 --- /dev/null +++ b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_default.xsd @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:simpleType name="Hello"> + <xs:restriction base="xs:string"> + <xs:maxLength value="72"/> + </xs:restriction> + </xs:simpleType> + +</xs:schema> http://git-wip-us.apache.org/repos/asf/cxf/blob/ce2c3121/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_import.wsdl ---------------------------------------------------------------------- diff --git a/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_import.wsdl b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_import.wsdl new file mode 100644 index 0000000..123ff1e --- /dev/null +++ b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_import.wsdl @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<wsdl:definitions name="HelloWorld" targetNamespace="http://apache.org/hello_soap_http" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://apache.org/hello_soap_http" + xmlns:x1="http://apache.org/hello_soap_http/types" + xmlns:x2="http://apache.org/hello_soap_http/types2" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <wsdl:types> + <schema targetNamespace="http://apache.org/hello_soap_http/types" + xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://apache.org/hello_soap_http/types" + elementFormDefault="qualified"> + <xsd:import namespace="http://apache.org/hello_soap_http/types2" + schemaLocation="http://apache.org/hello_soap_http/hello_types2.xsd"/> + <element name="hello"> + <complexType> + <sequence> + <element name="requestType" type="xsd:string"/> + </sequence> + </complexType> + </element> + <element name="helloResponse"> + <complexType> + <sequence> + <element name="responseType" type="x2:MyHello"/> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + <wsdl:message name="helloRequest"> + <wsdl:part element="x1:hello" name="in"/> + </wsdl:message> + <wsdl:message name="helloResponse"> + <wsdl:part element="x1:helloResponse" name="out"/> + </wsdl:message> + <wsdl:portType name="Greeter"> + <wsdl:operation name="hello"> + <wsdl:input message="tns:helloRequest" name="helloRequest"/> + <wsdl:output message="tns:helloResponse" name="helloResponse"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + + <wsdl:operation name="hello"> + <soap:operation soapAction="" style="document"/> + <wsdl:input name="helloRequest"> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output name="helloResponse"> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> + <wsdl:service name="SOAPService"> + <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort"> + <soap:address location="http://localhost:9000/SoapContext/SoapPort"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> + http://git-wip-us.apache.org/repos/asf/cxf/blob/ce2c3121/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_types2.xsd ---------------------------------------------------------------------- diff --git a/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_types2.xsd b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_types2.xsd new file mode 100644 index 0000000..5f55575 --- /dev/null +++ b/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf6580/hello_types2.xsd @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<xs:schema version="1.0" targetNamespace="http://apache.org/hello_soap_http/types2" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:import schemaLocation="http://apache.org/hello_soap_http/hello_default.xsd"/> + + <xs:simpleType name="MyHello"> + <xs:restriction base="Hello"></xs:restriction> + </xs:simpleType> + +</xs:schema>