I digged into aegis code and here is my constatations.

The shemaType attribute of my custom type is overriden in the
AbstractTypeCreator.createUserType method. The code of the method is :

           Type type = (Type) info.getType().newInstance();

           QName name = info.getTypeName();
           if (name == null)
               name = createQName(info.getTypeClass());

           type.setSchemaType(name);
           type.setTypeClass(info.getTypeClass());
           type.setTypeMapping(getTypeMapping());

In my case "info.getTypeName" returns null. When doing a call hierarchy on
setTypeName I see that the typeName can only be defined by a XmlAttribute
annotation. This annotation cannot be associated with my property. So it
seems there is no way to specify the schemaType in my case : is this a bug
or not ?

The only way I found to change the type in my schema is to override the
getSchemaType method in my custom type and to always return "xsd:date". It
does not seems to be the best way to do that : Is there something else I can
do ?

Regards

Seb

On 12/20/06, Sebastien Cesbron <[EMAIL PROTECTED]> wrote:

Hi,

I want to customize the wsdl generated with aegis binding with
annotations. I have a customType to map a custom Date classe to an xsd:date
element.

With my code, I do not generate complexe types for my custom date type but
in my main object, the type of the element is not "xsd:date" but
"ns2:MyDate".

My POJO is something like :

@XmlType(name = "Foo")
public class Foo
{
    @XmlElement(type = MyDateType.class)
    public MyDate getDate()
    {
        return myDate;
    }
}

and my custom type is :

public class MyDateType extends Type
{

    public MyDateType()
    {
        setTypeClass(MyDate.class);
        setSchemaType(new QName("xsd:date"));
    }

    @Override
    public Object readObject(MessageReader aReader, MessageContext
aContext) throws XFireFault
    {
        ...
    }

    @Override
    public void writeObject(Object aObject, MessageWriter aWriter,
MessageContext aContext) throws XFireFault
    {
        ...
    }
}

and the generated wsdl :

<xsd:complexType name="Foo"
>
  <xsd:sequence>
    <xsd:element minOccurs="0"
name="date" nillable="true" type=
"ns2:MyDate"/>
  </xsd:sequence>
  <xsd:anyAttribute/>

</xsd:complexType>

I have tried to add a TypeRegistrar like in the doc : is it necessary with 
annotations ? But also with this registrar the generated wsdl is not
correct : is there something more I have to do to generate the right type for 
my date in my wsdl file ?


Thanx

Seb




Reply via email to