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 Michal Gietka <gi...@interia.pl> on 2003/05/03 15:52:29 UTC

Inheritance problem (HELP!!!)

Hi !!!

I think i have problem with inheritance (mapping classes in WSDL) when using
Web Services with Axis 1.0. During type mapping fields in the subclass
DISAPPEARS !!!

I have two classes:

1)=================

package warehouse.util;
public class Item {
    public int id;
    public int label;
}

2)=================

package warehouse.util;
public class Unit extends warehouse.util.Item {
    public String eeeeeFake;
}

I used Java2WSDL to generate wsdl file for the service. The result type
mapping is here and it seems to be allright:

        <schema targetNamespace="http://util.warehouse"
xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
            <complexType name="Item">
                <sequence>
                    <element name="id" type="xsd:int"/>
                    <element name="label" type="xsd:int"/>
                </sequence>
            </complexType>
            <complexType name="Unit">
                <complexContent>
                    <extension base="tns1:Item">
                        <sequence>
                            <element name="eeeeeFake" nillable="true"
type="xsd:string"/>
                        </sequence>
                    </extension>
                </complexContent>
            </complexType>
            <element name="Item" nillable="true" type="tns1:Item"/>
        </schema>

Now I used the WSDL2Java to generate all classes for Web Service. I used
previously generated WSDL file to generate java classes. I attached code of
new classes at the bottom of the message (I cut off some code in this e-mail
not to extend message to much). You should see that they seems to be proper.

Now I have compiled classes and I have coppied them to my
{webapp}/WEB-INF/classes directory. Then I have deployed the service (to be
sure I attached deploy.wsdd below to classes)

And finally I used web browser to get WSDL for that Service using:

http://localhost:6060/warehouse/services/CommonServices?wsdl

The type mapping in the result wsdl looks like this:

<schema targetNamespace="http://util.warehouse"
xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    <complexType name="Item">
        <sequence>
            <element name="id" type="xsd:int" />
            <element name="label" type="xsd:int" />
        </sequence>
    </complexType>
    <complexType name="Unit">
        <complexContent>
            <extension base="tns1:Item">
                <sequence />
            </extension>
        </complexContent>
    </complexType>
    <element name="Item" nillable="true" type="tns1:Item" />
</schema>

AS YOU CAN SEE... THERE IS NOT ANY FIELD IN THE SUBCLASS !!! And the client
that uses Unit type (in that case .NET) can only access fields from Item
type (id, label) !!!!!!! Do you know anything about this ???

Best regards, Giecia








1)===========================================
package warehouse.util;

public class Item  implements java.io.Serializable {
    private int id;
    private int label;

    public Item() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getLabel() {
        return label;
    }

    public void setLabel(int label) {
        this.label = label;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {...}
    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {...}

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(Item.class);

    static {...};
    public static org.apache.axis.description.TypeDesc getTypeDesc(...)
{...}
    public static org.apache.axis.encoding.Serializer getSerializer(...)
{...}
    public static org.apache.axis.encoding.Deserializer getDeserializer(...)
{...}

}


2)===========================================

package warehouse.util;

public class Unit  extends warehouse.util.Item  implements
java.io.Serializable {
    private java.lang.String eeeeeFake;

    public Unit() {
    }

    public java.lang.String getEeeeeFake() {
        return eeeeeFake;
    }

    public void setEeeeeFake(java.lang.String eeeeeFake) {
        this.eeeeeFake = eeeeeFake;
    }


    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {...}
    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {...}

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(Unit.class);

    static {...};
    public static org.apache.axis.description.TypeDesc getTypeDesc(...)
{...}
    public static org.apache.axis.encoding.Serializer getSerializer(...)
{...}
    public static org.apache.axis.encoding.Deserializer getDeserializer(...)
{...}

}


deploy.wsdd ===========================================

...

      <typeMapping
        xmlns:ns="http://util.warehouse"
        qname="ns:Item"
        type="java:warehouse.util.Item"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      />
      <typeMapping
        xmlns:ns="http://util.warehouse"
        qname="ns:Unit"
        type="java:warehouse.util.Unit"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      />
...


----------------------------------------------------------------------
Dla tych, co sie cenia... >>> http://link.interia.pl/f1713 



Re: Inheritance problem (HELP!!!)

Posted by Michal Gietka <gi...@interia.pl>.
Hi !!!

It's me once again... I found the critical point of this problem. When I
used generated java classes to produce WSDL I had the same trouble. The
problematic code is field:

        private static org.apache.axis.description.TypeDesc typeDesc

and (especially) method:

        public static org.apache.axis.description.TypeDesc getTypeDesc();

in java classes that was generated by Axis during Java2WSDL.
I must say that is very strange symptom.

Greetings from Giecia.




----- Original Message -----
From: "Michal Gietka" <xx...@xxxxxxx.xx>
To: <ax...@ws.apache.org>
Sent: Friday, May 02, 2003 3:32 PM
Subject: Inheritance problem (HELP!!!)


> Hi !!!
>
> I think i have problem with inheritance (mapping classes in WSDL) when
using
> Web Services with Axis 1.0. During type mapping fields in the subclass
> DISAPPEARS !!!
>
> I have two classes:
>
> 1)=================
>
> package warehouse.util;
> public class Item {
>     public int id;
>     public int label;
> }
>
> 2)=================
>
> package warehouse.util;
> public class Unit extends warehouse.util.Item {
>     public String eeeeeFake;
> }
>
> I used Java2WSDL to generate wsdl file for the service. The result type
> mapping is here and it seems to be allright:
>
>         <schema targetNamespace="http://util.warehouse"
> xmlns="http://www.w3.org/2001/XMLSchema">
>             <import
namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>             <complexType name="Item">
>                 <sequence>
>                     <element name="id" type="xsd:int"/>
>                     <element name="label" type="xsd:int"/>
>                 </sequence>
>             </complexType>
>             <complexType name="Unit">
>                 <complexContent>
>                     <extension base="tns1:Item">
>                         <sequence>
>                             <element name="eeeeeFake" nillable="true"
> type="xsd:string"/>
>                         </sequence>
>                     </extension>
>                 </complexContent>
>             </complexType>
>             <element name="Item" nillable="true" type="tns1:Item"/>
>         </schema>
>
> Now I used the WSDL2Java to generate all classes for Web Service. I used
> previously generated WSDL file to generate java classes. I attached code
of
> new classes at the bottom of the message (I cut off some code in this
e-mail
> not to extend message to much). You should see that they seems to be
proper.
>
> Now I have compiled classes and I have coppied them to my
> {webapp}/WEB-INF/classes directory. Then I have deployed the service (to
be
> sure I attached deploy.wsdd below to classes)
>
> And finally I used web browser to get WSDL for that Service using:
>
> http://localhost:6060/warehouse/services/CommonServices?wsdl
>
> The type mapping in the result wsdl looks like this:
>
> <schema targetNamespace="http://util.warehouse"
> xmlns="http://www.w3.org/2001/XMLSchema">
>     <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
>     <complexType name="Item">
>         <sequence>
>             <element name="id" type="xsd:int" />
>             <element name="label" type="xsd:int" />
>         </sequence>
>     </complexType>
>     <complexType name="Unit">
>         <complexContent>
>             <extension base="tns1:Item">
>                 <sequence />
>             </extension>
>         </complexContent>
>     </complexType>
>     <element name="Item" nillable="true" type="tns1:Item" />
> </schema>
>
> AS YOU CAN SEE... THERE IS NOT ANY FIELD IN THE SUBCLASS !!! And the
client
> that uses Unit type (in that case .NET) can only access fields from Item
> type (id, label) !!!!!!! Do you know anything about this ???
>
> Best regards, Giecia
>
>
>
>
>
>
>
>
> 1)===========================================
> package warehouse.util;
>
> public class Item  implements java.io.Serializable {
>     private int id;
>     private int label;
>
>     public Item() {
>     }
>
>     public int getId() {
>         return id;
>     }
>
>     public void setId(int id) {
>         this.id = id;
>     }
>
>     public int getLabel() {
>         return label;
>     }
>
>     public void setLabel(int label) {
>         this.label = label;
>     }
>
>     private java.lang.Object __equalsCalc = null;
>     public synchronized boolean equals(java.lang.Object obj) {...}
>     private boolean __hashCodeCalc = false;
>     public synchronized int hashCode() {...}
>
>     // Type metadata
>     private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(Item.class);
>
>     static {...};
>     public static org.apache.axis.description.TypeDesc getTypeDesc(...)
> {...}
>     public static org.apache.axis.encoding.Serializer getSerializer(...)
> {...}
>     public static org.apache.axis.encoding.Deserializer
getDeserializer(...)
> {...}
>
> }
>
>
> 2)===========================================
>
> package warehouse.util;
>
> public class Unit  extends warehouse.util.Item  implements
> java.io.Serializable {
>     private java.lang.String eeeeeFake;
>
>     public Unit() {
>     }
>
>     public java.lang.String getEeeeeFake() {
>         return eeeeeFake;
>     }
>
>     public void setEeeeeFake(java.lang.String eeeeeFake) {
>         this.eeeeeFake = eeeeeFake;
>     }
>
>
>     private java.lang.Object __equalsCalc = null;
>     public synchronized boolean equals(java.lang.Object obj) {...}
>     private boolean __hashCodeCalc = false;
>     public synchronized int hashCode() {...}
>
>     // Type metadata
>     private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(Unit.class);
>
>     static {...};
>     public static org.apache.axis.description.TypeDesc getTypeDesc(...)
> {...}
>     public static org.apache.axis.encoding.Serializer getSerializer(...)
> {...}
>     public static org.apache.axis.encoding.Deserializer
getDeserializer(...)
> {...}
>
> }
>
>
> deploy.wsdd ===========================================
>
> ...
>
>       <typeMapping
>         xmlns:ns="http://util.warehouse"
>         qname="ns:Item"
>         type="java:warehouse.util.Item"
>         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
>
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
>         encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>       />
>       <typeMapping
>         xmlns:ns="http://util.warehouse"
>         qname="ns:Unit"
>         type="java:warehouse.util.Unit"
>         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
>
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
>         encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>       />
> ...
>


----------------------------------------------------------------------
Dla tych, co sie cenia... >>> http://link.interia.pl/f1713