Author: ema
Date: Thu Mar 22 04:36:11 2007
New Revision: 521224
URL: http://svn.apache.org/viewvc?view=rev&rev=521224
Log:
[CXF-469] Enable tools to generate multiple interface class for wsdl with no
service
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
(with props)
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
(with props)
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
(with props)
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=521224&r1=521223&r2=521224
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
Thu Mar 22 04:36:11 2007
@@ -88,7 +88,7 @@
import static org.apache.cxf.helpers.CastUtils.cast;
public class WSDLServiceBuilder {
-
+
public static final String WSDL_SCHEMA_LIST =
WSDLServiceBuilder.class.getName() + ".SCHEMA";
public static final String WSDL_DEFINITION =
WSDLServiceBuilder.class.getName() + ".DEFINITION";
public static final String WSDL_SERVICE =
WSDLServiceBuilder.class.getName() + ".SERVICE";
@@ -158,7 +158,25 @@
return buildService(def, serv, null);
}
- public ServiceInfo buildMockService(Definition def) {
+
+ public List<ServiceInfo> buildMockServices(Definition d) {
+ List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
+ List<Definition> defList = new ArrayList<Definition>();
+ defList.add(d);
+ parseImports(d, defList);
+ for (Definition def : defList) {
+ for (Iterator ite = def.getPortTypes().entrySet().iterator();
ite.hasNext();) {
+ Entry entry = (Entry)ite.next();
+ PortType portType = def.getPortType((QName)entry.getKey());
+ ServiceInfo serviceInfo = this.buildMockService(def, portType);
+ serviceList.add(serviceInfo);
+ }
+ }
+ return serviceList;
+ }
+
+
+ public ServiceInfo buildMockService(Definition def, PortType p) {
DescriptionInfo description = new DescriptionInfo();
description.setProperty(WSDL_DEFINITION, def);
description.setName(def.getQName());
@@ -170,17 +188,13 @@
service.setDescription(description);
service.setProperty(WSDL_DEFINITION, def);
XmlSchemaCollection schemas = getSchemas(def, service);
-
-
+
service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
service.setProperty(WSDL_SCHEMA_LIST, schemas);
+
+ buildInterface(service, p);
- for (Iterator ite = def.getPortTypes().entrySet().iterator();
ite.hasNext();) {
- Entry entry = (Entry)ite.next();
- PortType portType = def.getPortType((QName)entry.getKey());
- buildInterface(service, portType);
- }
return service;
}
@@ -533,7 +547,6 @@
private void checkForWrapped(OperationInfo opInfo) {
MessageInfo inputMessage = opInfo.getInput();
MessageInfo outputMessage = opInfo.getOutput();
-
boolean passedRule = true;
// RULE No.1:
// The operation's input and output message (if present) each contain
@@ -547,7 +560,6 @@
if (!passedRule) {
return;
}
-
XmlSchemaCollection schemas =
(XmlSchemaCollection)opInfo.getInterface().getService()
.getProperty(WSDL_SCHEMA_LIST);
XmlSchemaElement inputEl = null;
@@ -571,7 +583,6 @@
if (!passedRule) {
return;
}
-
// RULE No.3:
// The output message part refers to a global element declaration
MessagePartInfo outputPart = null;
@@ -590,7 +601,6 @@
if (!passedRule) {
return;
}
-
// RULE No.4 and No5:
// wrapper element should be pure complex type
@@ -632,7 +642,6 @@
if (!passedRule) {
return;
}
-
// we are wrappable!!
opInfo.setUnwrappedOperation(unwrapped);
unwrapped.setInput(opInfo.getInputName(), unwrappedInput);
@@ -691,7 +700,6 @@
private void buildMessage(AbstractMessageContainer minfo, Message msg,
List paramOrder) {
XmlSchemaCollection schemas =
(XmlSchemaCollection)minfo.getOperation().getInterface().getService()
.getProperty(WSDL_SCHEMA_LIST);
-
List orderedParam = msg.getOrderedParts(paramOrder);
for (Part part : cast(orderedParam, Part.class)) {
MessagePartInfo pi = minfo.addMessagePart(new
QName(minfo.getName().getNamespaceURI(), part
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?view=diff&rev=521224&r1=521223&r2=521224
==============================================================================
---
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
Thu Mar 22 04:36:11 2007
@@ -142,8 +142,7 @@
} else if (definition.getServices().size() > 0) {
serviceList = serviceBuilder.buildService(definition);
} else {
- ServiceInfo service =
serviceBuilder.buildMockService(definition);
- serviceList.add(service);
+ serviceList = serviceBuilder.buildMockServices(definition);
}
context.put(ClassCollector.class, new ClassCollector());
@@ -152,7 +151,8 @@
}
Map<String, InterfaceInfo> interfaces = new HashMap<String,
InterfaceInfo>();
for (ServiceInfo service : serviceList) {
- if
(!interfaces.containsKey(service.getInterface().getName().toString())) {
+ if (service.getInterface() != null
+ &&
!interfaces.containsKey(service.getInterface().getName().toString())) {
interfaces.put(service.getInterface().getName().toString(),
service.getInterface());
}
}
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=521224&r1=521223&r2=521224
==============================================================================
---
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
Thu Mar 22 04:36:11 2007
@@ -323,4 +323,14 @@
processor.setContext(env);
processor.execute();
}
+
+ public void testNoServiceImport() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
getLocation("/wsdl2java_wsdl/helloworld_noservice_import.wsdl"));
+ processor.setContext(env);
+ processor.execute();
+ Class cls = classLoader.loadClass("org.apache.hello_world1.Greeter");
+ assertNotNull(cls);
+ cls = classLoader.loadClass("org.apache.hello_world2.Greeter2");
+ }
+
}
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl?view=auto&rev=521224
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
(added)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
Thu Mar 22 04:36:11 2007
@@ -0,0 +1,39 @@
+<?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="HelloWorldImport"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/hello_world"
+ xmlns:x1="http://apache.org/hello_world/messages"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/hello_world">
+
+
+ <wsdl:import
+ namespace="http://apache.org/hello_world1"
+ location="./helloworld_noservice_imported1.wsdl"/>
+
+ <wsdl:import
+ namespace="http://apache.org/hello_world2"
+ location="./helloworld_noservice_imported2.wsdl"/>
+
+
+</wsdl:definitions>
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_import.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl?view=auto&rev=521224
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
(added)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
Thu Mar 22 04:36:11 2007
@@ -0,0 +1,67 @@
+<?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="HelloWorldImport1"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/hello_world1"
+ xmlns:x1="http://apache.org/hello_world/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/hello_world1">
+ <wsdl:types>
+ <schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:x1="http://apache.org/hello_world/types"
+ targetNamespace="http://apache.org/hello_world/types"
+ elementFormDefault="qualified">
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="short" form="qualified"
minOccurs="0"/>
+ <element name="major" type="short" form="qualified"
minOccurs="0"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="pingMeRequest">
+ <wsdl:part name="in" element="x1:pingMe"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeResponse">
+ <wsdl:part name="out" element="x1:pingMeResponse"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeFault">
+ <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+ </wsdl:message>
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="pingMe">
+ <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+ <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+ <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+</wsdl:definitions>
\ No newline at end of file
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported1.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl?view=auto&rev=521224
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
(added)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
Thu Mar 22 04:36:11 2007
@@ -0,0 +1,58 @@
+<?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="HelloWorldImport2"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/hello_world2"
+ xmlns:x1="http://apache.org/hello_world/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/hello_world2">
+ <wsdl:types>
+ <schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/hello_world/types"
+ elementFormDefault="qualified">
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part name="in" element="x1:sayHi"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part name="out" element="x1:sayHiResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="Greeter2">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+</wsdl:definitions>
\ No newline at end of file
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/helloworld_noservice_imported2.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml