Author: ema
Date: Wed Feb 29 09:17:24 2012
New Revision: 1295026
URL: http://svn.apache.org/viewvc?rev=1295026&view=rev
Log:
[CXF-4147]:Wrong wsdl generated from impl class annotated with BARE
Added:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/HelloBare.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties?rev=1295026&r1=1295025&r2=1295026&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
Wed Feb 29 09:17:24 2012
@@ -38,4 +38,4 @@ XSD_VALIDATION_ERROR= Error in W3C XML S
COULD_NOT_UNWRAP=Could not unwrap Operation {0} to match method "{1}"
NO_WSDL_PROVIDED=WSDL is required for services created from class {0}, but no
WSDL location specified.
NO_FAULT_PART = Could not find a fault part for {0}. The fault message must
have a single part.
-
+INVALID_BARE_METHOD= Method {0} is configured as BARE but there are more than
one parameters with wrong @Webparam annotated or without @WebParam annotated.
Modified:
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1295026&r1=1295025&r2=1295026&view=diff
==============================================================================
---
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++
cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Wed Feb 29 09:17:24 2012
@@ -480,7 +480,6 @@ public class ReflectionServiceFactoryBea
for (OperationInfo opInfo :
serviceInfo.getInterface().getOperations()) {
Method m = (Method)opInfo.getProperty(METHOD);
-
if (!isWrapped(m) && !isRPC(m) && opInfo.getInput() != null) {
createBareMessage(serviceInfo, opInfo, false);
}
@@ -1487,8 +1486,15 @@ public class ReflectionServiceFactoryBea
continue;
}
if (isInParam(method, j)) {
- final QName q = getInParameterName(op, method, j);
- MessagePartInfo part = inMsg.addMessagePart(getInPartName(op,
method, j));
+ QName q = getInParameterName(op, method, j);
+ QName partName = getInPartName(op, method, j);
+ if (!isRPC(method) && !isWrapped(method)
+ && inMsg.getMessagePartsMap().containsKey(partName)) {
+ LOG.log(Level.WARNING, "INVALID_BARE_METHOD",
getServiceClass() + "." + method.getName());
+ partName = new QName(partName.getNamespaceURI(),
partName.getLocalPart() + j);
+ q = new QName(q.getNamespaceURI(), q.getLocalPart() + j);
+ }
+ MessagePartInfo part = inMsg.addMessagePart(partName);
Added:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/HelloBare.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/HelloBare.java?rev=1295026&view=auto
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/HelloBare.java
(added)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/HelloBare.java
Wed Feb 29 09:17:24 2012
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.tools.java2wsdl.processor;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+
+@SOAPBinding(parameterStyle = ParameterStyle.BARE)
+@WebService
+public class HelloBare {
+ @WebMethod
+ public void add(int a, String b) {
+
+ }
+}
Modified:
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=1295026&r1=1295025&r2=1295026&view=diff
==============================================================================
---
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++
cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Wed Feb 29 09:17:24 2012
@@ -678,4 +678,25 @@ public class JavaToProcessorTest extends
assertTrue(wsdlContent.indexOf("<xsd:element
name=\"UserExceptionFault\"") != -1);
}
+
+ //CXF-4147
+ @Test
+ public void testBareWithoutWebParam() throws Exception {
+ env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() +
"/cxf4147.wsdl");
+ env.put(ToolConstants.CFG_CLASSNAME,
"org.apache.cxf.tools.java2wsdl.processor.HelloBare");
+ env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE);
+ try {
+ processor.setEnvironment(env);
+ processor.process();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ File wsdlFile = new File(output, "cxf4147.wsdl");
+ assertTrue(wsdlFile.exists());
+ String wsdlContent = getStringFromFile(wsdlFile).replaceAll(" ", " ");
+ assertTrue(wsdlContent.indexOf("xsd:element name=\"add\"
nillable=\"true\" type=\"xsd:int\"") != -1);
+ assertTrue(wsdlContent.indexOf("xsd:element name=\"add1\"
nillable=\"true\" type=\"xsd:string\"")
+ != -1);
+ assertTrue(wsdlContent.indexOf("wsdl:part name=\"add1\"
element=\"tns:add1\"") != -1);
+ }
}