Hi Jim,

When AegisDatabinding.intialize() is called, it searches through all the
operations and classes on the service class and creates Types for them. You
shouldn't have to manually register any types for your scenario.

Maybe try this simplified code:

ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(BookService.class);
factory.setAddress("http://localhost:8088/Hello";);
factory.getServiceFactory().setDataBinding(new AegisDatabinding());
BookService client = (BookService) factory.create();


Regards,
- Dan

On 7/3/07, Jim Ma <[EMAIL PROTECTED]> wrote:

Hi Dan ,

I want to figure out if we can implement another code first tool using
aegis databinding  to generate client code and server code.
for the pojo service class and types classes. The server code is simple
and easy to write ,we only need to set Aegis databinding
for the service factory . But the client code need to register type
class in Aegis like below snippet :

        ClientProxyFactoryBean proxyFactory = new
ClientProxyFactoryBean();
        ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean
();
        clientBean.setAddress("http://localhost:8088/Hello";);
        clientBean.setBus(CXFBusFactory.getDefaultBus());
        clientBean.setTransportId("http://schemas.xmlsoap.org/wsdl/http/
");
        clientBean.setServiceClass(BookService.class);
        BookService client = (BookService) proxyFactory.create();
        ClientImpl c = (ClientImpl)clientBean.getClient();

        AegisDatabinding db = new AegisDatabinding();
        Service  s = c.getEndpoint().getService();
        s.setDataBinding(db);
        db.initialize(s);

        TypeMapping tm = (TypeMapping) s.get(TypeMapping.class.getName());
        BeanType type = new BeanType();
        type.setSchemaType(new QName("http://org.codehaus.xfire.client";,
"Book"));
        type.setTypeClass(Book.class);
        type.setTypeMapping(tm);
        tm.register(type);

        Book book = new Book();
        book.setTitle("myname is share");
        book.setIsbn("isbn");
        client.addBook(book);

Is there any way we can simplify register type mapping in aegis by
reflecting interface class ?
Can we register types class in Aegis like this ?
        TypeMapping tm = (TypeMapping) s.get(TypeMapping.class.getName());
         tm.registerByRef(BookService.class);

I do not know if Aegis can use converted package name and classname as
default namespace and localpart to construct Aegis
schemaType for every types class, and if it can construct BeanType ,
ArrrayType or other type by reflecting the types class .

Thanks

Jim






--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to