tuscany-maven-wsdl2java generates wrong code when a element is unbound
----------------------------------------------------------------------

                 Key: TUSCANY-2453
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2453
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Tools
    Affects Versions: Java-SCA-1.2
            Reporter: Miguel Angel Alonso



Executing the maven plugin:

...
                        <plugin>
                                <groupId>org.apache.tuscany.sca</groupId>
                                <artifactId>tuscany-maven-wsdl2java</artifactId>
                        <version>1.2.1-incubating</version>
                <dependencies>
                     <dependency>
                        <groupId>org.apache.tuscany.sca</groupId>
                        <artifactId>tuscany-wsdl2java</artifactId>
                        <version>1.2.1-incubating</version>
                    </dependency> 
                </dependencies>
                                <executions>
                                        <execution>
                                                <configuration>
                                                        
<targetDirectory>${basedir}/target/generated-sources/wsdl2java-source</targetDirectory>
                                                        
<wsdlFile>${basedir}/src/main/wsdl/CuentasCliente.wsdl</wsdlFile>
                                                </configuration>
                                                <goals>
                                                        <goal>generate</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
                    ....

where the wsdl CuentasCliente.wsdl contains:

    ....
    <types>
        <xsd:schema targetNamespace="http://itecban.es/wsdl/CuentasCliente"; 
xmlns:ns1="http://itecban.es/schema/transferencia";>
            <xsd:import namespace="http://itecban.es/schema/transferencia"; 
schemaLocation="transferencia.xsd"/>
            <xsd:element name="clienteId">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:long"/>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="cuentas">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="codigo" type="xsd:string" 
maxOccurs="unbounded"></xsd:element>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </types>
    <message name="CuentasClienteOperationRequest">
        <part name="part1" element="tns:clienteId"/>
    </message>
    <message name="CuentasClienteOperationResponse">
        <part name="part1" element="tns:cuentas"/>
    </message>
    ...

The result is: 

    public interface CuentasClientePortType {
         public java.lang.String CuentasClienteOperation(
         long clienteId) throws  java.rmi.RemoteException;
       }

The created interface method is wrong because is returning a String instead of 
a list

If I execute the Apache CXF maven plugin:

                        <plugin>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-codegen-plugin</artifactId>
                                <version>2.1</version>
                                <executions>
                                        <execution>
                                                <id>generate-sources</id>
                                                <phase>generate-sources</phase>
                                                <configuration>
                                                        
<sourceRoot>${basedir}/target/generated-sources/cxf</sourceRoot>
                                                        <wsdlOptions>
                                                                <wsdlOption>
                                                                        
<wsdl>${basedir}/src/main/wsdl/CuentasCliente.wsdl</wsdl>
                                                                </wsdlOption>
                                                </configuration>
                                                <goals>
                                                        <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>

The result is:

public interface CuentasClientePortType {

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(name = "cuentas", targetNamespace = 
"http://itecban.es/wsdl/CuentasCliente";, partName = "part1")
    @WebMethod(operationName = "CuentasClienteOperation")
    public Cuentas cuentasClienteOperation(
        @WebParam(partName = "part1", name = "clienteId", targetNamespace = 
"http://itecban.es/wsdl/CuentasCliente";)
        long part1
    );
}

This result is correct beacuse the method is returning a class, Cuentas, which 
contains a list.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to