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

Bryan Keech commented on CXF-6747:
----------------------------------

this is how I have the plugin setup:
{code:java}
    <dependency>

      <groupId>org.apache.cxf.xjc-utils</groupId>

      <artifactId>cxf-xjc-runtime</artifactId>

      <version>${cxf.xjc-utils.version}</version>

    </dependency>

</dependencies>



<build>

   <plugins>

      <plugin>

        <groupId>org.apache.cxf</groupId>

        <artifactId>cxf-codegen-plugin</artifactId>

        <version>3.2.4</version>

        <executions>

          <execution>

            <id>generate-sources</id>

            <phase>generate-sources</phase>

            <configuration>

             <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>

           <wsdlOptions>

            <wsdlOption>

     <wsdl>${basedir}/src/main/config/EnvironmentManagementService.wsdl</wsdl>

             <extraargs>

               <extraarg>-xjc-Xbug986</extraarg>

             </extraargs>

           </wsdlOption>

         </wsdlOptions>

      </configuration>

      <goals>

        <goal>wsdl2java</goal>

      </goals>

    </execution>

  </executions>

  <dependencies>

    <dependency>

      <groupId>org.apache.cxf.xjcplugins</groupId>

      <artifactId>cxf-xjc-bug986</artifactId>

      <version>3.2.1</version>

   </dependency>

  </dependencies>

</plugin>
{code}
but still the class has the enum annotated with:
{code:java}
@XmlSchemaType(name = "string")

    protected LoadBalancerState loadbalancerState;
{code}
 

> XSD to Java problem with enums
> ------------------------------
>
>                 Key: CXF-6747
>                 URL: https://issues.apache.org/jira/browse/CXF-6747
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 3.0.1
>            Reporter: Dusan Slivka
>            Assignee: Daniel Kulp
>            Priority: Major
>             Fix For: Invalid
>
>         Attachments: Screen Shot 2018-05-04 at 10.15.22 AM.png, Screen Shot 
> 2018-05-04 at 10.21.49 AM.png
>
>
> Starting with version 3, roundtrip wsdl -> Java -> wsdl produces output wsdl 
> different from wsdl on input, if there are enums used. For example, I have 
> the folowing XSD type in source wsdl:
> {code:xml}
>   <xs:simpleType name="checksumType">
>     <xs:restriction base="xs:string">
>       <xs:enumeration value="MD5"/>
>       <xs:enumeration value="SHA256"/>
>     </xs:restriction>
>   </xs:simpleType>
>   <xs:complexType name="DigestType">
>     <xs:sequence>
>       <xs:element minOccurs="0" name="digestValue" type="xs:string"/>
>       <xs:element minOccurs="0" name="digestType" type="tns:checksumType"/>
>     </xs:sequence>
>   </xs:complexType>
> {code}
> which produces (cxf-codegen-plugin:3.0.5:wsdl2java) the following Java code:
> {code:java}
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "DigestType", propOrder = {
>     "digestValue",
>     "digestType"
> })public class DigestType {
>     protected String digestValue;
>     @XmlSchemaType(name = "string")  // WHY??
>     protected ChecksumType digestType;
> }
> {code}
> And resulting wsdl for published service looks like this:
> {code:xml}
>   <xs:simpleType name="checksumType">
>     <xs:restriction base="xs:string">
>       <xs:enumeration value="MD5"/>
>       <xs:enumeration value="SHA256"/>
>     </xs:restriction>
>   </xs:simpleType>
>   <xs:complexType name="DigestType">
>     <xs:sequence>
>       <xs:element minOccurs="0" name="digestValue" type="xs:string"/>
>       <xs:element minOccurs="0" name="digestType" type="xs:string"/>
>       <!-- xs:string instead of tns:checksumType -->
>     </xs:sequence>
>   </xs:complexType>
> {code}
> The problem is caused by @XmlSchemaType(name = "string") annotation. I think 
> resulting wsdl should be equal to source wsdl.
> See also:
> [https://github.com/gf-metro/jaxb/issues/21]
> [http://stackoverflow.com/questions/33346803/how-to-tell-jaxb-not-to-generate-xmlschematype-annotation]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to