Author: mmao
Date: Wed Aug 8 01:38:13 2007
New Revision: 563789
URL: http://svn.apache.org/viewvc?view=rev&rev=563789
Log:
CXF-883 enableWrapperStyle works as a global settings
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cust.xml
Modified:
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Modified:
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java?view=diff&rev=563789&r1=563788&r2=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomNodeSelector.java
Wed Aug 8 01:38:13 2007
@@ -58,6 +58,9 @@
if (prefix != null
&& !context.getUsedNamespaces().containsKey(prefix)
&& targetNode.lookupPrefix(ns) != null) {
+ if ("xmlns".equals(prefix)) {
+ continue;
+ }
context.addNamespace(prefix, ns);
}
}
Modified:
incubator/cxf/trunk/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/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?view=diff&rev=563789&r1=563788&r2=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Wed Aug 8 01:38:13 2007
@@ -382,8 +382,9 @@
if (wsdlURI.normalize().equals(normalizedURL)) {
jaxwsBindings.add(root);
} else {
- String wsdl = (String)env.get(ToolConstants.CFG_WSDLURL);
- Message msg = new Message("NOT_POINTTO_URL", LOG, new Object[]
{bindingFile, wsdl});
+ Message msg = new Message("NOT_POINTTO_URL", LOG, new Object[]
{bindingFile,
+
wsdlURI.normalize(),
+
normalizedURL});
throw new ToolException(msg);
}
} else if (isValidJaxbBindingFile(reader)) {
Modified:
incubator/cxf/trunk/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/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties?view=diff&rev=563789&r1=563788&r2=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
Wed Aug 8 01:38:13 2007
@@ -20,7 +20,7 @@
#
STAX_PARSER_ERROR = StAX parser error, check your external binding file(s)
UNKNOWN_BINDING_FILE= Unknown external binding files : {0}
-NOT_POINTTO_URL = External binding file: {0} does not point to the specified
wsdl url:{1}
+NOT_POINTTO_URL = External binding file: {0} does not point to the specified
wsdl: {2}, resolved as {1}
JAXWSBINDINGS_WSDLLOC_ERROR = Attribute wsdlLocation 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}
Modified:
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?view=diff&rev=563789&r1=563788&r2=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Wed Aug 8 01:38:13 2007
@@ -84,7 +84,7 @@
private Object bindingObj;
private ServiceInfo service;
- private JAXWSBinding jaxwsBinding = new JAXWSBinding();
+ private final JAXWSBinding jaxwsBinding = new JAXWSBinding();
public ServiceProcessor(ToolContext penv) {
super(penv);
@@ -133,10 +133,8 @@
if (serviceBinding.isEnableMime()) {
jaxwsBinding.setEnableMime(true);
}
+
jaxwsBinding.setEnableWrapperStyle(serviceBinding.isEnableWrapperStyle());
- if (serviceBinding.isEnableWrapperStyle()) {
- jaxwsBinding.setEnableWrapperStyle(true);
- }
if (serviceBinding.getJaxwsClass() != null
&& serviceBinding.getJaxwsClass().getClassName() != null) {
name = serviceBinding.getJaxwsClass().getClassName();
@@ -213,7 +211,6 @@
JAXWSBinding infBinding = infInfo.getExtensor(JAXWSBinding.class);
-
if (infBinding != null) {
if (infBinding.getJaxwsClass() != null
&&
!StringUtils.isEmpty(infBinding.getJaxwsClass().getClassName())) {
@@ -223,7 +220,6 @@
if (!infBinding.isEnableAsyncMapping()) {
jaxwsBinding.setEnableAsyncMapping(false);
}
-
if (!infBinding.isEnableWrapperStyle()) {
jaxwsBinding.setEnableWrapperStyle(false);
}
@@ -361,7 +357,7 @@
if (jaxwsBinding.isEnableMime() || enableOpMime) {
jm.setMimeEnable(true);
}
-
+
if (jm.isWrapperStyle() && headerType > this.noHEADER
|| !jaxwsBinding.isEnableWrapperStyle()
|| jm.enableMime() && jm.isWrapperStyle()) {
Modified:
incubator/cxf/trunk/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/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?view=diff&rev=563789&r1=563788&r2=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Wed Aug 8 01:38:13 2007
@@ -171,14 +171,14 @@
return false;
}
- private CustomizationParser getCustomizationParer() {
+ private CustomizationParser getCustomizationParser() {
return cusParser;
}
private Definition buildCustomizedDefinition() throws Exception {
File tmpFile = File.createTempFile("customzied", ".wsdl");
OutputStream outs = new FileOutputStream(tmpFile);
- DOMUtils.writeXml(getCustomizationParer().getCustomizedWSDLElement(),
outs);
+ DOMUtils.writeXml(getCustomizationParser().getCustomizedWSDLElement(),
outs);
InputStream ins = new FileInputStream(new File(tmpFile.toURI()));
Document wsdlDoc = DOMUtils.readXml(ins);
Definition def =
wsdlReader.readWSDL(this.wsdlDefinition.getDocumentBaseURI(),
Modified:
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=563789&r1=563788&r2=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Wed Aug 8 01:38:13 2007
@@ -1105,5 +1105,18 @@
}
}
+ @Test
+ public void testGlobalBinding() throws Exception {
+ env.put(ToolConstants.CFG_BINDING,
getLocation("/wsdl2java_wsdl/cust.xml"));
+ env.put(ToolConstants.CFG_WSDLURL,
getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
+ processor.setContext(env);
+ processor.execute();
+
+ File greeter = new File(output,
"org/apache/hello_world_soap_http/Greeter.java");
+ assertTrue(output.exists());
+ String contents = getStringFromFile(greeter);
+ assertTrue(contents.indexOf("SOAPBinding.ParameterStyle.BARE") != -1);
+ assertTrue(contents.indexOf("@ResponseWrapper") == -1);
+ }
}
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cust.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cust.xml?view=auto&rev=563789
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cust.xml
(added)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cust.xml
Wed Aug 8 01:38:13 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.
+-->
+<jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ wsdlLocation="hello_world.wsdl"
+ xmlns="http://java.sun.com/xml/ns/jaxws"
+ xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
+
+ <enableWrapperStyle>false</enableWrapperStyle>
+
+</jaxws:bindings>
\ No newline at end of file