[
https://issues.apache.org/jira/browse/CXF-8305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17140814#comment-17140814
]
Steve Armstrong commented on CXF-8305:
--------------------------------------
Okay, but this will take some time. I'll try to get to it on the weekend. We
use the ant based {{org.apache.cxf.tools.wsdlto.WSDLToJava}} that expects the
lib folder of apache-cxf-3.3.6 to be on the classpath. I will provide an ant
property where you can set that as you wish. I will assume that Java 8 will be
on your PATH.
I will try to keep the WSDL as simple as possible.
Do you own xjc that is actually performing the code generation under the
covers, or are you getting that from elsewhere and simply integrating it into
CXF offering? I'm pretty sure that the code generation of attributes that are
arrays of arrays of something (in my case bytes) has never have been tested
with collectionType="indexed" since I really doubt the bug in code generation
highlighted above is specific to a 2 dimensional _byte_ array.
Anyway, is there anything else aside from the things I have noted above that
you need for a complete test case?
Thanks.
> WSDL2Java generates java code that won't compile for array of byte arrays
> -------------------------------------------------------------------------
>
> Key: CXF-8305
> URL: https://issues.apache.org/jira/browse/CXF-8305
> Project: CXF
> Issue Type: Bug
> Components: Tooling
> Affects Versions: 3.3.6
> Reporter: Steve Armstrong
> Priority: Critical
>
> I am using a wsdl snippet that looks like the following:
> {code:xml}
> <xsd:complexType name="CACertificateLDAPGetResult">
> <xsd:annotation>
> <xsd:documentation>
> Defines the results of a caCertificateLDAPGet
> operation
> </xsd:documentation>
> </xsd:annotation>
> <xsd:sequence>
> <xsd:element name="Binary" type="xsd:boolean"
> nillable="true">
> <xsd:annotation>
> <xsd:documentation>
> Indicates whether the returns attribute is
> string data or binary data.
> True if the attribute is binary.
> </xsd:documentation>
> </xsd:annotation>
> </xsd:element>
> <xsd:element name="StringAttribute" maxOccurs="unbounded"
> minOccurs="0" type="xsd:string" nillable="true" >
> <xsd:annotation>
> <xsd:documentation>
> A list of the strings found at a string
> attribute.
> </xsd:documentation>
> </xsd:annotation>
> </xsd:element>
> <xsd:element name="BinaryAttribute" maxOccurs="unbounded"
> minOccurs="0" type="xsd:base64Binary"
> nillable="true" >
> <xsd:annotation>
> <xsd:documentation>
> A list of the base64 encoded data found at a
> binary attribute.
> </xsd:documentation>
> </xsd:annotation>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> {code}
> In is the BinaryAttribute above that is of interest.
> When this gets compiled using WSDL2Java and Java 8 with
> collectionType="indexed", the following code snipped is produced.
>
> {code:java}
> /**
> *
> *
> * @param values
> * allowed objects are
> * byte[]
> */
> public void setBinaryAttribute(byte[][] values) {
> int len = values.length;
> this.binaryAttribute = ((byte[][]) new byte[][len] );
> for (int i = 0; (i<len); i ++) {
> this.binaryAttribute[i] = ((byte[]) values[i]);
> }
> }
> {code}
> Clearly, this is invalid Java since you need to set len on the first
> dimension of the array, not the second.
> Java can't compile the code generated by WSDL2Java so that's the end of
> things.
> If you know of any work-around (other than *not* using
> collectionType="indexed", please let me know. Thanks!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)