cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Bertram (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7074) wsdl2java generates invalid Java code when fault element is imported
Date Sun, 02 Oct 2016 02:46:20 GMT

    [ https://issues.apache.org/jira/browse/CXF-7074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15539590#comment-15539590
] 

Niels Bertram commented on CXF-7074:
------------------------------------

Essentially the fully qualified classname of the faultInfo field {{fField}} created on line
[134|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/FaultProcessor.java#L134]
of the [FaultProcessor.java|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/FaultProcessor.java]
is not set correctly.

Intersestingly the {{fPackageName}} set on line line [131|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/FaultProcessor.java#L131]
is compared against itself on line [137|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/FaultProcessor.java#L137]
so that condition would never execute, the fault message itself would always be in the same
package as the method interface itself (unless someone can tell me how to put a {{wsdl:message}}
definition into a different namespace.

{code:xml}
<wsdl:message name="TheCxfWrapperException" > <-- probably always be the same namespace
as the operation
  <wsdl:part name="fault" element="u:Fault" />
</wsdl:message>
{code}

The conditional code would still fail to set the correct classname of the faultInfo field
{{fField}} as neither line [138|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/FaultProcessor.java#L138]
or [141|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/FaultProcessor.java#L141]
produce a fully qualified classname for the `faultInfo` part even if they would be executed.

So downstream problem proably also in [ProcessorUtil.java|https://github.com/apache/cxf/blob/master/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java]
or [NameUtil.java|https://github.com/apache/cxf/blob/master/tools/common/src/main/java/org/apache/cxf/tools/util/NameUtil.java#L260].


> wsdl2java generates invalid Java code when fault element is imported
> --------------------------------------------------------------------
>
>                 Key: CXF-7074
>                 URL: https://issues.apache.org/jira/browse/CXF-7074
>             Project: CXF
>          Issue Type: Bug
>          Components: Soap Binding
>    Affects Versions: 3.1.7
>            Reporter: Niels Bertram
>
> CXF wsdl2java tooling generates invalid Java sources when the fault element  in the fault
message is imported from a copmilation eposide.
> I created a wsdl that defines a xml schema with an include from a already packaged XSD/bindings
jar.
> {code:xml}
> <wsdl:types>
>   <xsd:schema targetNamespace="urn:io.fares.model.example.utility" xmlns="urn:io.fares.model.example.utility">
>     <xsd:include schemaLocation="utility/Fault.xsd"/>
>   </xsd:schema>
> </wsdl:types>
> {code}
> it then references an element defined in the referenced schema
> {code:xml}
> <wsdl:message name="GetCustomerException">
>   <wsdl:part name="err" element="u:Fault"/>
> </wsdl:message>
> {code}
> but when it generates code it fails to fully qualify the name of the imported and already
generated XML Bean / Java class.
> {code:java}
> package io.fares.examples.one.services; // <---- generated into the services' package
> import javax.xml.ws.WebFault;
> // <--- I would expect another import of io.fares.model.example.utility.Fault here
> @WebFault(name = "Fault", targetNamespace = "urn:io.fares.model.example.utility")
> public class GetCustomerException extends RuntimeException {
>     public static final long serialVersionUID = 1L;
>     
>     private Fault fault; // <--- Fault should be fully qualified class name but its
not
>     // ...
>     public Fault getFaultInfo() {
>         return this.fault;
>     }
> }
> {code}
> I think the problem is somewhere around {{org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil.getFullClzName}}
but have not been able to figure out exactly why it fails to insert the fully qualified class
name into the generated exception.
> An example showing the failed copmilation can be found on [GitHub|https://github.com/fareliner/design-builder-examples/tree/master/multi-dependency/service-a]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message