Hi!

We are facing the following problem:

We send object trees to a webservice which are bound to Java classes by
Aegis and persisted by Hibernate. There are some associations which are not
cascaded to the database, e.g. Bill->Product, because the Products are sent
before separately and during persisting of the Bill, only the references to
the Product objects are needed in the object tree.

What we want to do is to create a WSDL that forbids adding complete Products
to a Bill by defining a ProductRef object as the type of the Bill.products
property. The ProductRef object has only an ID.
The thing is that there should not be ProductRef classes on the server side
(on the client side, of course, ProductRef client stubs will be generated
from the WSDL). Product Java classes should directly be mapped to a WSDL
ProductRef datatype.

While this works for non-array properties with the following mapping:

    <mapping>
        <property name="description" 
            type="com.example.TextRefType" 
            typeName="{example.com}TextRef"
            />
    </mapping>

and the following Custom Type

   public class TextRefType extends ObjectType {
    private static final Class<com.example.Text> componentClass =
com.example.Text.class;
    protected QName qname = QName.valueOf ("{http://example.com}TextRef";);
 
    public TextRefType()
    {
        setTypeClass(componentClass);
        setSchemaType(qname);
    }
 
    public Object readObject(MessageReader reader, MessageContext context)
throws XFireFault
    {
        ...
        
        return new Text();
    }
 
    public void writeObject(Object object, MessageWriter writer,
MessageContext context)
    {
        ...
    }

we did not get it to work for collection types, like the Bill->Product
association.
It is possible to specify a class, that should be mapped using the
componentType=... attribute, but obviously this does not work using a Custom
Type as componentType=.... :

    <mapping>
                <property name="products" 
                        componentType="com.example.ProductRefType" 
                />
    </mapping>

The exception I get is

   19:31:55,937 ERROR [XFireServletController] Couldn't invoke servlet
request.
   org.codehaus.xfire.XFireRuntimeException: Couldn't create type for
property depe
   ndencies on class org.codehaus.xfire.aegis.type.basic.ObjectType: Cannot
create
   mapping for java.util.Set, unspecified component type for interface
java.util.Se
   t

Any clues how to handle that scenario are most welcome!!
-- 
View this message in context: 
http://old.nabble.com/Custom-type-mapping-of-collection-property-with-Aegis-tp28885256p28885256.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to