You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Wes Munsil <mu...@alumni.caltech.edu> on 2006/01/24 22:36:50 UTC

Re: Problem serializing array of complex types

Does anyone have a clue about what to do about this? I'm seeing what looks
like the same problem. Axis 1.3 WSDL2Java is generating int instead of
ArrayOfint. Also happens with arrays of complex types.

WSDL has this:

   <types>
      <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:top">
         <xsd:complexType name="ArrayOfint">
            <xsd:complexContent>
               <xsd:restriction base="SOAP-ENC:Array">
                  <xsd:attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="xsd:int[]"/>
               </xsd:restriction>
            </xsd:complexContent>
         </xsd:complexType>
         <xsd:complexType name="Context">
            <xsd:sequence>
               <xsd:element name="ErrorCode" type="tns:ArrayOfint"/>
            </xsd:sequence>
         </xsd:complexType>
      </xsd:schema>
   </types>

WSDL2Java generates this:

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:top",
"Context"));
        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
        elemField.setFieldName("errorCode");
        elemField.setXmlName(new javax.xml.namespace.QName("", "ErrorCode"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"int"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

Original message:
=================

Hi iksrazal!
I must admit I'm not an expert but:
Comparing the Java-files produced with 1.1RC2 with those produced with
newer releases there seems to be one relevant difference:

1.1RC2 sets the XmlType in the following way:
elemField.setXmlType(new javax.xml.namespace.QName("http://...",
"ArrayOfY"));
        typeDesc.addFieldDesc(elemField);

the newer ones do it like this:
elemField.setXmlType(new javax.xml.namespace.QName("http://...", "Y"));
        typeDesc.addFieldDesc(elemField);

So the prefix "ArrayOf" is missing. If I add "ArrayOf" manually to the
generated code everything works great. So I think it is not a schema
question.
Thanx,
Grmlfz

> --- Urspr&#65533;ngliche Nachricht ---
> Von: iksrazal <ik...@gmail.com>
> An: axis-user@ws.apache.org
> Betreff: Re: Problem serializing array of complex types
> Datum: Thu, 29 Dec 2005 16:26:13 -0200
>
> Grmlfz,
>
> I'm not understanding your problem. I've used those evil soapenc
> arrays quite a bit. What's does or doesn't it do? Your wsdl files are
> the same always, right ? What you show different is seemingly schema
> stuff, which doesn't have anything to do with wsdl2java.
>
> Try clarifying your question a bit. (Maybe its the holidays and I'm
> not thinking clearly yet). What result stays the same? From where?
>
> iksrazal
> http://www.braziloutsource.com/
>
> Em Quinta 29 Dezembro 2005 16:01, o grmlfz@gmx.at escreveu:
> > Hi!
> > I'm using WSDL2Java to generate Java-files from a customers WSDL-files.
> > These WSDL-files use complex types containing arrays of other
> > complex types. Till now we used 1.1RC2 to generate the Java-files.
> > This worked
> well
> > serializing the array to somthing like this:
> >
> >      <X soapenc:arrayType="ns2:Y[2]" xmlns:ns2="..."
> xmlns:soapenc="...">
> >       <item>
> >        <ADR_TYP>M</ADR_TYP>
> >        <ADRESSEN_EXTRA xsi:nil="true"/>
> >       </item>
> >       <item>
> >        <ADR_TYP>M</ADR_TYP>
> >        <ADRESSEN_EXTRA xsi:nil="true"/>
> >       </item>
> >      </X>
> >
> > Now I tried the same with Axis 1.2 and 1.3 and got somthing like
> > that
> >
> >   <X>
> >      <ADR_TYP>M</ADR_TYP>
> >      <ADRESSEN_EXTRA xsi:nil="true"/>
> >   </X>
> >   <X>
> >      <ADR_TYP>M</ADR_TYP>
> >      <ADRESSEN_EXTRA xsi:nil="true"/>
> >   </X>
> >
> > The WSDL in both cases is the same. I think I've tried each
> > available switch, but the result stays the same.
> >
> > Is this a bug or what am I doing wrong?
> >
> > Thanks in advance,
> > Grmlfz
>
> --
>

--
DSL-Aktion wegen gro&#65533;er Nachfrage bis 28.2.2006 verl&#65533;ngert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl


Re: Problem serializing array of complex types

Posted by Wes Munsil <mu...@alumni.caltech.edu>.
Thanks, I neglected to mention that I had tried that, and it didn't help.

Anne Thomas Manes said:
> Try using the -w or --wrapArrays option on WSDL2Java and see if that
> helps.
>
> Anne
>
> On 1/24/06, Wes Munsil <mu...@alumni.caltech.edu> wrote:
>>
>> Does anyone have a clue about what to do about this? I'm seeing what
>> looks
>> like the same problem. Axis 1.3 WSDL2Java is generating int instead of
>> ArrayOfint. Also happens with arrays of complex types.
>>
>> WSDL has this:
>>
>>    <types>
>>       <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
>> targetNamespace="urn:top">
>>          <xsd:complexType name="ArrayOfint">
>>             <xsd:complexContent>
>>                <xsd:restriction base="SOAP-ENC:Array">
>>                   <xsd:attribute ref="SOAP-ENC:arrayType"
>> wsdl:arrayType="xsd:int[]"/>
>>                </xsd:restriction>
>>             </xsd:complexContent>
>>          </xsd:complexType>
>>          <xsd:complexType name="Context">
>>             <xsd:sequence>
>>                <xsd:element name="ErrorCode" type="tns:ArrayOfint"/>
>>             </xsd:sequence>
>>          </xsd:complexType>
>>       </xsd:schema>
>>    </types>
>>
>> WSDL2Java generates this:
>>
>>     static {
>>         typeDesc.setXmlType(new javax.xml.namespace.QName("urn:top",
>> "Context"));
>>         org.apache.axis.description.ElementDesc elemField = new
>> org.apache.axis.description.ElementDesc();
>>         elemField.setFieldName("errorCode");
>>         elemField.setXmlName(new javax.xml.namespace.QName("",
>> "ErrorCode"));
>>         elemField.setXmlType(new
>> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
>> "int"));
>>         elemField.setNillable(false);
>>         typeDesc.addFieldDesc(elemField);
>>     }
>>
>> Original message:
>> ================>
>> Hi iksrazal!
>> I must admit I'm not an expert but:
>> Comparing the Java-files produced with 1.1RC2 with those produced with
>> newer releases there seems to be one relevant difference:
>>
>> 1.1RC2 sets the XmlType in the following way:
>> elemField.setXmlType(new javax.xml.namespace.QName("http://...",
>> "ArrayOfY"));
>>         typeDesc.addFieldDesc(elemField);
>>
>> the newer ones do it like this:
>> elemField.setXmlType(new javax.xml.namespace.QName("http://...", "Y"));
>>         typeDesc.addFieldDesc(elemField);
>>
>> So the prefix "ArrayOf" is missing. If I add "ArrayOf" manually to the
>> generated code everything works great. So I think it is not a schema
>> question.
>> Thanx,
>> Grmlfz
>>
>> > --- Urspr&#65533;ngliche Nachricht ---
>> > Von: iksrazal <ik...@gmail.com>
>> > An: axis-user@ws.apache.org
>> > Betreff: Re: Problem serializing array of complex types
>> > Datum: Thu, 29 Dec 2005 16:26:13 -0200
>> >
>> > Grmlfz,
>> >
>> > I'm not understanding your problem. I've used those evil soapenc
>> > arrays quite a bit. What's does or doesn't it do? Your wsdl files are
>> > the same always, right ? What you show different is seemingly schema
>> > stuff, which doesn't have anything to do with wsdl2java.
>> >
>> > Try clarifying your question a bit. (Maybe its the holidays and I'm
>> > not thinking clearly yet). What result stays the same? From where?
>> >
>> > iksrazal
>> > http://www.braziloutsource.com/
>> >
>> > Em Quinta 29 Dezembro 2005 16:01, o grmlfz@gmx.at escreveu:
>> > > Hi!
>> > > I'm using WSDL2Java to generate Java-files from a customers
>> WSDL-files.
>> > > These WSDL-files use complex types containing arrays of other
>> > > complex types. Till now we used 1.1RC2 to generate the Java-files.
>> > > This worked
>> > well
>> > > serializing the array to somthing like this:
>> > >
>> > >      <X soapenc:arrayType="ns2:Y[2]" xmlns:ns2="..."
>> > xmlns:soapenc="...">
>> > >       <item>
>> > >        <ADR_TYP>M</ADR_TYP>
>> > >        <ADRESSEN_EXTRA xsi:nil="true"/>
>> > >       </item>
>> > >       <item>
>> > >        <ADR_TYP>M</ADR_TYP>
>> > >        <ADRESSEN_EXTRA xsi:nil="true"/>
>> > >       </item>
>> > >      </X>
>> > >
>> > > Now I tried the same with Axis 1.2 and 1.3 and got somthing like
>> > > that
>> > >
>> > >   <X>
>> > >      <ADR_TYP>M</ADR_TYP>
>> > >      <ADRESSEN_EXTRA xsi:nil="true"/>
>> > >   </X>
>> > >   <X>
>> > >      <ADR_TYP>M</ADR_TYP>
>> > >      <ADRESSEN_EXTRA xsi:nil="true"/>
>> > >   </X>
>> > >
>> > > The WSDL in both cases is the same. I think I've tried each
>> > > available switch, but the result stays the same.
>> > >
>> > > Is this a bug or what am I doing wrong?
>> > >
>> > > Thanks in advance,
>> > > Grmlfz
>> >
>> > --
>> >
>>
>> --
>> DSL-Aktion wegen gro&#65533;er Nachfrage bis 28.2.2006
>> verl&#65533;ngert:
>> GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl
>>
>>
>


Re: Problem serializing array of complex types

Posted by Anne Thomas Manes <at...@gmail.com>.
Try using the -w or --wrapArrays option on WSDL2Java and see if that helps.

Anne

On 1/24/06, Wes Munsil <mu...@alumni.caltech.edu> wrote:
>
> Does anyone have a clue about what to do about this? I'm seeing what looks
> like the same problem. Axis 1.3 WSDL2Java is generating int instead of
> ArrayOfint. Also happens with arrays of complex types.
>
> WSDL has this:
>
>    <types>
>       <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="urn:top">
>          <xsd:complexType name="ArrayOfint">
>             <xsd:complexContent>
>                <xsd:restriction base="SOAP-ENC:Array">
>                   <xsd:attribute ref="SOAP-ENC:arrayType"
> wsdl:arrayType="xsd:int[]"/>
>                </xsd:restriction>
>             </xsd:complexContent>
>          </xsd:complexType>
>          <xsd:complexType name="Context">
>             <xsd:sequence>
>                <xsd:element name="ErrorCode" type="tns:ArrayOfint"/>
>             </xsd:sequence>
>          </xsd:complexType>
>       </xsd:schema>
>    </types>
>
> WSDL2Java generates this:
>
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("urn:top",
> "Context"));
>         org.apache.axis.description.ElementDesc elemField = new
> org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("errorCode");
>         elemField.setXmlName(new javax.xml.namespace.QName("",
> "ErrorCode"));
>         elemField.setXmlType(new
> javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
> "int"));
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>     }
>
> Original message:
> =================
>
> Hi iksrazal!
> I must admit I'm not an expert but:
> Comparing the Java-files produced with 1.1RC2 with those produced with
> newer releases there seems to be one relevant difference:
>
> 1.1RC2 sets the XmlType in the following way:
> elemField.setXmlType(new javax.xml.namespace.QName("http://...",
> "ArrayOfY"));
>         typeDesc.addFieldDesc(elemField);
>
> the newer ones do it like this:
> elemField.setXmlType(new javax.xml.namespace.QName("http://...", "Y"));
>         typeDesc.addFieldDesc(elemField);
>
> So the prefix "ArrayOf" is missing. If I add "ArrayOf" manually to the
> generated code everything works great. So I think it is not a schema
> question.
> Thanx,
> Grmlfz
>
> > --- Urspr&#65533;ngliche Nachricht ---
> > Von: iksrazal <ik...@gmail.com>
> > An: axis-user@ws.apache.org
> > Betreff: Re: Problem serializing array of complex types
> > Datum: Thu, 29 Dec 2005 16:26:13 -0200
> >
> > Grmlfz,
> >
> > I'm not understanding your problem. I've used those evil soapenc
> > arrays quite a bit. What's does or doesn't it do? Your wsdl files are
> > the same always, right ? What you show different is seemingly schema
> > stuff, which doesn't have anything to do with wsdl2java.
> >
> > Try clarifying your question a bit. (Maybe its the holidays and I'm
> > not thinking clearly yet). What result stays the same? From where?
> >
> > iksrazal
> > http://www.braziloutsource.com/
> >
> > Em Quinta 29 Dezembro 2005 16:01, o grmlfz@gmx.at escreveu:
> > > Hi!
> > > I'm using WSDL2Java to generate Java-files from a customers
> WSDL-files.
> > > These WSDL-files use complex types containing arrays of other
> > > complex types. Till now we used 1.1RC2 to generate the Java-files.
> > > This worked
> > well
> > > serializing the array to somthing like this:
> > >
> > >      <X soapenc:arrayType="ns2:Y[2]" xmlns:ns2="..."
> > xmlns:soapenc="...">
> > >       <item>
> > >        <ADR_TYP>M</ADR_TYP>
> > >        <ADRESSEN_EXTRA xsi:nil="true"/>
> > >       </item>
> > >       <item>
> > >        <ADR_TYP>M</ADR_TYP>
> > >        <ADRESSEN_EXTRA xsi:nil="true"/>
> > >       </item>
> > >      </X>
> > >
> > > Now I tried the same with Axis 1.2 and 1.3 and got somthing like
> > > that
> > >
> > >   <X>
> > >      <ADR_TYP>M</ADR_TYP>
> > >      <ADRESSEN_EXTRA xsi:nil="true"/>
> > >   </X>
> > >   <X>
> > >      <ADR_TYP>M</ADR_TYP>
> > >      <ADRESSEN_EXTRA xsi:nil="true"/>
> > >   </X>
> > >
> > > The WSDL in both cases is the same. I think I've tried each
> > > available switch, but the result stays the same.
> > >
> > > Is this a bug or what am I doing wrong?
> > >
> > > Thanks in advance,
> > > Grmlfz
> >
> > --
> >
>
> --
> DSL-Aktion wegen gro&#65533;er Nachfrage bis 28.2.2006 verl&#65533;ngert:
> GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl
>
>