[
https://issues.apache.org/jira/browse/CXF-6071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14190229#comment-14190229
]
Keith Halligan commented on CXF-6071:
-------------------------------------
I've tried both using the Java 7 and 8 version of wsimport, and they both work
with the tool.
>From my understanding, the wsimport isn't generating the implementation
>classes, but the rest of the JAX-WS artifacts that the wsdl describes.
The issue in CXF is that when the -impl flag is passed into the wsdl2java tool,
with the current wsdl, which is perfectly valid (according to wsimport.exe, and
cxf's own wsdlvalidator tool). The generated implementation class is generated
incorrectly, it should be mapped to a compilable source module, and it's not.
I've tried to do the mapping in an xjb binding file:
{code}
<jaxws:bindings version="1.0"
wsdlLocation="iacc_servants.wsdl"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<jaxws:bindings
node="wsdl:definitions/wsdl:service/wsdl:port[@name='IACC.ServerCORBAPort']">
<jaxws:class name="IACCServerCORBAPort" />
</jaxws:bindings>
</jaxws:bindings>
{code}
This still results in CXF generating the incorrect implementation, the xjb file
made no difference, we still get the same two implementation classes generated:
{noformat}
dir /b com\iona\schemas\idl\iacc_idl\*Impl.java
CORBAPortImpl.java
IACC.ServerCORBAPortImpl.java
{noformat}
> CXF's WSDL2Java tool can generate impl classes that jdk compiler will refuse
> to compile
> ---------------------------------------------------------------------------------------
>
> Key: CXF-6071
> URL: https://issues.apache.org/jira/browse/CXF-6071
> Project: CXF
> Issue Type: Bug
> Components: Tooling
> Affects Versions: 3.0.1, 3.0.2
> Environment: All
> Reporter: Keith Halligan
> Fix For: 3.0.3
>
> Attachments: iacc_servants.wsdl
>
>
> When using Apache CXF 3.0.1 and above the following WSDL (attached) will
> compile with the wsdl2java tool, however the code cannot be compiled as the
> implementation class cannot be compiled with any JDK.
> The issue is that the generated implementation class has a "." in the class
> name.
> eg:
> D:\programming\artix\apache-cxf-3.0.1-bin\bin\test>dir /b
> com\iona\schemas\idl\iacc_idl\*Impl.java
> CORBAPortImpl.java
> IACC.ServerCORBAPortImpl.java
> Below is a patch that works around the issue, while still keeping the current
> functionality in place, only switching back to the old functionality (changed
> in: CXF-5456) when the port name contains non-valid characters as far as a
> JVM compiler is concerned.
> {noformat}
> diff --git
> a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
>
> b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
> index 5fe090d..63dc84d 100644
> ---
> a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
> +++
> b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ImplGenerator.java
> @@ -21,6 +21,8 @@ package
> org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
> import java.util.HashMap;
> import java.util.Map;
> +import java.util.regex.Pattern;
> +import java.util.regex.Matcher;
> import javax.xml.namespace.QName;
> @@ -126,12 +128,17 @@ public class ImplGenerator extends
> AbstractJAXWSGenerator {
> }
> String name = nm.get(service + "/" + port);
> if (name == null) {
> - name = port + "Impl";
> + name = (isPortNameCompliant(port)) ? port : intf.getName() +
> "Impl";
> name = mapClassName(intf.getPackageName(), name, penv);
> nm.put(service + "/" + port, name);
> }
> return name;
> }
> +
> + private boolean isPortNameCompliant(String port) {
> + return Pattern.matches("[a-zA-Z]\\w*", port);
> + }
> +
> private String mapClassName(String packageName, String name, ToolContext
> context) {
> ClassCollector collector = context.get(ClassCollector.class);
> int count = 0;
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)