1) The WSDL2Java tool has minimal error reporting at the present time.
This is do to the following reasons:
 - The tool is fairly new with limited developer resources.  We have chosen
to use our resources to add additional mappings instead of issuing messages
for the myriad of unsupported types.
- We may wish to re-write the parsing checking code....so the current
implementation could be considered a first pass at development.

2) As far as the mapping for union, does there need to be a check to make
sure you get the object in the same way that you set it ?

I think we could add this support post beta 2.

public class VersionInfo {
   public Object value;

   public Object getValue() {
       return value;
   }

   public int getValueAsInt() {
      return ((Integer) value).value();
   }

   public Calendar getValueAsCalendar() {
      return (Calendar) value;
   }

   public void setValue(Calendar value) {
       this.value = value;
   }

   public void setValue(int value) {
       this.value = new Integer(value);
   }
}

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                       
                                     
                      Glen Daniels                                                     
                                     
                      <gdaniels@macrome        To:       "'[EMAIL PROTECTED]'" 
<[EMAIL PROTECTED]>              
                      dia.com>                 cc:                                     
                                     
                                               Subject:  RE: wsdl2java: union of 
simpleType                                 
                      04/28/2002 04:12                                                 
                                     
                      PM                                                               
                                     
                      Please respond to                                                
                                     
                      axis-dev                                                         
                                     
                                                                                       
                                     
                                                                                       
                                     




Hi Richard:

We don't yet claim to support union types, so I'm not surprised you got
some weirdness.  We should probably (as a minimal first step) be better
about reporting an error when we come across a schema construct which we
don't understand.

How would unions be represented in java?  Something like this?

public class VersionInfo {
   public Object value;

   public Object getValue() {
       return value;
   }

   public void setValue(Calendar value) {
       this.value = value;
   }

   public void setValue(int value) {
       this.value = new Integer(value);
   }
}

--Glen

> -----Original Message-----
> From: Richard Emberson [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, April 28, 2002 3:29 PM
> To: [EMAIL PROTECTED]
> Subject: wsdl2java: union of simpleType
>
>
> Using wsdl2java, latest cvs (as of yesterday), when attempt to produce
> Java code for the following
>
>     <xsd:simpleType name="VersionInfo">
>         <xsd:union memberTypes="xsd:dateTime xsd:int"/>
>     </xsd:simpleType>
>
> I get a class with no instance variable(s) nor any getters or
> settors -
> hard to (de)serialize.
>
> If I try:
>
>     <xsd:simpleType name="VersionInfo">
>           <xsd:union>
>             <xsd:simpleType>
>               <xsd:restriction base="xsd:dateTime"/>
>             </xsd:simpleType>
>             <xsd:simpleType>
>               <xsd:restriction base="xsd:int"/>
>             </xsd:simpleType>
>           </xsd:union>
>     </xsd:simpleType>
>
> I get:
>
> java.io.IOException: urn:login:VersionInfo already exists
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.symbolTablePut(SymbolT
> able.java:1781)
>
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.createTypeFromDef(Symb
> olTable.java:749)
>
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:568)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:638)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:638)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:638)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:638)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:638)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.addTypes(SymbolTable.java:638)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.populateTypes(SymbolTa
> ble.java:531)
>
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.populate(SymbolTable.java:424)
>         at
> org.apache.axis.wsdl.toJava.SymbolTable.add(SymbolTable.java:330)
>         at org.apache.axis.wsdl.toJava.Emitter.emit(Emitter.java:188)
>         at org.apache.axis.wsdl.toJava.Emitter.emit(Emitter.java:155)
>         at
> org.apache.axis.wsdl.WSDL2Java$WSDLRunnable.run(WSDL2Java.java:725)
>         at java.lang.Thread.run(Thread.java:536)
>
> Last Summer when I wrote a wsdl2java transformer (I used XSL) I found
> unions to be the
> hardest part .... I guess its the hardest part of Axis also
> .... but any
> help would still
> be appreciated.
>
> Richard
>



Reply via email to