cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Code first tool proposal
Date Thu, 26 Jul 2007 08:15:41 GMT
On Thursday 26 July 2007 04:02, Liu, Jervis wrote:
> Looks like the main concern for merging java2cs and java2wsdl together
> into one tool is java2wsdl brings a lot of flags, which complicates
> the new java2 tool. How about we do this in an incremental manor? We
> implement a new java2 tool first with basic flags suggested by Jim.
> Once the first version is out of door, based on the feedback from user
> groups, such as Eclipse STP project, we can exam these extra flags
> provided by java2wsdl (such as "-servicename <service-name> -portname
> <port-name> -createxsdimports") one by one to see if the flag is
> really necessary for a code-first approach.

However, think about it in the opposite direction....   For java2wsdl to 
support the other frontends/databindings, all the flags on java2cs 
except for -client and -server need to be added to java2wsdl.   Thus, 
java2wsdl pretty much already ends up with almost all the flags.   Plus, 
a bunch of work would be needed to get java2wsdl to actually support 
those frontend/databinding.    Since MOST of the flags are the same, it 
probably makes sense to just combine the two.

The other reason is that some of the stuff java2wsdl does doesn't 
really "make sense" from the name.   It generates wrapper objects, fault 
bean objects, etc... that are required for JAX-WS spec compliance.   
(but we don't actually need anymore)  That stuff would be better served 
with a "-jaxws-wrappers" flag or similar on a generic java2 tool.

Dan


>
> Cheers,
> Jervis
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: 2007?7?26? 15:28
> To: cxf-dev@incubator.apache.org
> Subject: Re: Code first tool proposal
>
>
>
> I'm 100% OK with the idea of better tooling around the code first
> stuff.
>
> My only concern is having two separate "java2" tools.   I think I'd
> prefer just having a single "java2" tool where -wsdl is just an
> option. The java2wsdl command line tool would be deprecated in favor
> of the new tool.   You mentioned internally invoking java2wsdl... 
> IMO, the java2wsdl code would be merged into this tool so there is
> only a single set of java2 stuff to maintain.
>
> Basically, I completely agree with Jervis.
>
> Dan
>
> On Tuesday 24 July 2007 22:54, Jim Ma wrote:
> > Hi All ,
> >
> > Here is my proposal for implementing a code first tool to generate
> > client  ,server side code and wsdl . With this tool , user can more
> > easily deploy a service with java class in cxf.
> > If this is OK, I will start on writing this tool.
> >
> > Goal
> > ----------
> > 1. Generate jaxws frontend client server code and wsdl from Jaxws
> > conformed classes
> > 2. Generate simple frontend client server code and wsdl from Pojo
> > class . Tool can generate and compile  interface class or impl class
> > the server and client side needed
> >     from the user provided classes.
> >
> > Tool Description
> > -----------
> > Tool Name    :   java2cs
> > Description    :   takes a user defined class to generate jaxws or
> > simple frontend client  and server side code
> > Options         :   -cp                classpath to load the user
> > defined classes
> >                         -server           generate server side code
> > only, if client and server is not specified , both client and server
> > code will be generated
> >                         -client             generate client side
> > code only -frontend        jaxws or simple , default is simple
> > frontend. which control to generate jaxws and simple style server 
> > and client -databinding   jaxb or aegis databinding. jaxws frontend
> > will use jaxb databinding  and simple frontend will use aegis
> > databinding by default .
> >                         -wsdl              control to generate wsdl.
> >                          class              the full class name used
> > to generate client and server
> >
> > Generated Code Sample
> > --------------------------
> > 1. jaxws frontend.
> >
> >         Server code :
> >         =========
> >                              public class Server {
> >                                      protected Server() throws
> > Exception { System.out.println("Starting Server");
> >                                             Object implementor = new
> > GreeterImpl();
> >                                              String address =
> > "http://localhost:9000/SoapContext/SoapPort";
> >                                            
> > Endpoint.publish(address, implementor);
> >                                       }
> >
> >                                  public static void main(String
> > args[]) throws Exception {
> >                                       new Server();
> >                                       System.out.println("Server
> > ready..."); Thread.sleep(5 * 60 * 1000); System.out.println("Server
> > exiting"); System.exit(0);
> >                                   }
> >                             }
> >
> >         Client code :
> >         ========
> >                                     ...
> >                                     SOAPService ss = new
> > SOAPService(wsdlURL, SERVICE_NAME);
> >                                     Greeter port = ss.getSoapPort();
> >                                     port.sayHi();
> >                                     ...............
> >
> > 2. simple frontend :
> >          Server code
> >          =========
> >                             ServerFactoryBean svrBean = new
> > ServerFactoryBean();
> >
> > svrBean.setBus(CXFBusFactory.getDefaultBus());
> >
> > svrBean.setAddress("http://localhost:8080/Hello");
> >
> > svrBean.setTransportId("http://schemas.xmlsoap.org/wsdl/http/");
> >
> > svrBean.setBindingId("http://schemas.xmlsoap.org/soap/");
> >                              svrBean.setServiceBean(new
> > GreeterImpl());
> >
> > svrBean.getServiceFactory().setDataBinding(new AegisDatabinding());
> >                              svrBean.setStart(true);
> >                              svrBean.create();
> >                              System.out.println("Server started");
> >
> >        Client code :
> >         ========
> >                           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(Greeter.class);
> >
> > proxyFactory.getServiceFactory().setDataBinding(new
> > AegisDatabinding()); Greeter client = (Greeter)
> > proxyFactory.create();
> >
> > Any thoughts and  directions would be appreciated !
> >
> > Thanks
> >
> > Jim

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
View raw message