You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Jim Ma <em...@iona.com> on 2007/07/25 04:54:27 UTC
Code first tool proposal
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
Re: Code first tool proposal
Posted by Jim Ma <em...@iona.com>.
Hi Dan ,
> 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.
>
+1.
> 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.
>
If user use simple frontend , we do not need to provide "-wrappers" or
"-classdir" flag for it . Also current wrapper objects is jaxb featured
classes,
we also need to check if the databinding is jaxb. IMHO, this may cause
some complexity for user to use this tool . Can we provide two generic
tool ,
one for jaxws frontend and one for simple frontend ?
Regards
jim
Re: Code first tool proposal
Posted by Glen Mazza <gl...@verizon.net>.
BTW, what is the purpose of the simple frontend server? Is it ever
intended to see production use, or is it primarily for newbies who are
not necessarily servlet-container knowledgeable? I wonder if we could
get rid of it and have people start using servlet containers/Java app
servers from day one instead.
Thanks,
Glen
Am Donnerstag, den 26.07.2007, 04:15 -0400 schrieb Daniel Kulp:
> > > ----------
> > > 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.
> > >
> > > 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");
> > >
Re: Code first tool proposal
Posted by Daniel Kulp <dk...@apache.org>.
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
RE: Code first tool proposal
Posted by "Liu, Jervis" <jl...@iona.com>.
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.
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
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Code first tool proposal
Posted by Daniel Kulp <dk...@apache.org>.
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
Re: Code first tool proposal
Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 25 July 2007 00:51, Johnson Ma wrote:
> *output location.
> Should be able the pass output locations for generated class and wsdl.
The java2wsdl tool already has flags for these.
> *vendor specific code
> For simple front-end case, I notice that the generated server code is
> calling cxf classes.
> Since both jax-ws and simple front-end has same input indeed (endpoint
> address and impl class), is it possible to generate same code to hide
> the complexity from end user.
> Let's say, in the endpoint.publish, if this is no jax-ws annotations
> on the imp class, you will know it is simple front-end, the setup the
> simple front-end stuff internally.
I don't think this is doable. Endpoint.publish has certain JAX-WS
compliance rules around it that if the impl doesn't have the appropriate
@WebService annotations and such, we have to throw various exceptions.
Not doing so would most likely break the JAX-WS compliance.
In anycase, the Simple frontend IS different than the JAX-WS frontend an
should be usable without the jaxws frontend module/api jars even loaded.
We could simplify the frontend startup code a bit if that would help.
Maybe a SimplFrontend.publish(...) or something.
Dan
>
> Regards
>
> Johnson
>
> ----- Original Message -----
> From: "Jim Ma" <em...@iona.com>
> To: <cx...@incubator.apache.org>
> Sent: Wednesday, July 25, 2007 10:54 AM
> Subject: Code first tool proposal
>
> > 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
Re: Code first tool proposal
Posted by Jim Ma <em...@iona.com>.
Hi Johnson,
Thank you for your great suggestions.
Johnson Ma wrote:
> flag is indicated to generate server mainline. If user start from sei
> interface, it is better to have a -impl flag to generate dummy impl
> class as well.
Since the server mainline need this class to start , I think the impl
class can be generated by default.
> *output location.
> Should be able the pass output locations for generated class and wsdl.
Agreed . Will add this flag.
> *endpoint address.
> For the pojo input, it would be better to have a optional flag for the
> endpoint address. Otherwise, user needs to manually modify the
> generated code according to their needs.
>
Agreed. Will provide this flag.
> *vendor specific code
> For simple front-end case, I notice that the generated server code is
> calling cxf classes.
> Since both jax-ws and simple front-end has same input indeed (endpoint
> address and impl class), is it possible to generate same code to hide
> the complexity from end user.
> Let's say, in the endpoint.publish, if this is no jax-ws annotations
> on the imp class, you will know it is simple front-end, the setup the
> simple front-end stuff internally.
Endpoint.publish() is the jaxws frontend api to publish a service .In*
*my opinion, simple frontend does not need to use jaxws specified api.
It is another frontend and
it can handle the case that jaxws frontend can not handle, so it uses
the cxf classes to start server and call a service . .I do not plan to
mix this two frontend to use same api to
publish or call a service.
Thoughts?
Regards
Jim
Re: Code first tool proposal
Posted by Johnson Ma <jo...@iona.com>.
Hi Jim,
It is much better than the current j2w ->w2j approach to support pojo at
tool level.
Some comments.
* Impl class.
>From both jaxws and simple front-end sample code, looks like the -server
flag is indicated to generate server mainline. If user start from sei
interface, it is better to have a -impl flag to generate dummy impl class as
well.
*output location.
Should be able the pass output locations for generated class and wsdl.
*endpoint address.
For the pojo input, it would be better to have a optional flag for the
endpoint address. Otherwise, user needs to manually modify the generated
code according to their needs.
*vendor specific code
For simple front-end case, I notice that the generated server code is
calling cxf classes.
Since both jax-ws and simple front-end has same input indeed (endpoint
address and impl class), is it possible to generate same code to hide the
complexity from end user.
Let's say, in the endpoint.publish, if this is no jax-ws annotations on the
imp class, you will know it is simple front-end, the setup the simple
front-end stuff internally.
Regards
Johnson
----- Original Message -----
From: "Jim Ma" <em...@iona.com>
To: <cx...@incubator.apache.org>
Sent: Wednesday, July 25, 2007 10:54 AM
Subject: Code first tool proposal
> 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
Re: Code first tool proposal
Posted by James Mao <ja...@iona.com>.
You definitely right, we planed to have a component to generate the
config files, and the component can be used by the wsdl2java and java2*
tools.
James.
> If you are going to generate the configuration file, we would like the
> same function to be added back to
> wsdl2java tool as well.
>
> Johnson
> ----- Original Message ----- From: "James Mao" <ja...@iona.com>
> To: <cx...@incubator.apache.org>
> Sent: Wednesday, July 25, 2007 11:26 AM
> Subject: Re: Code first tool proposal
>
>
>> Excellent work, Jim,
>>
>> If you can also comment on the relationship between the java2wsdl and
>> java2cs, that will be great
>> IMHO, the java2wsdl does support the jaxws, and simple frontend, but
>> it's only generate the wsdl, is it the duplicate function in the
>> java2cs,
>> Or is it possible to extend the java2wsdl (we need to find a better
>> name for it)
>> Or java2cs will call into the java2wsdl to generate the wsdl files,
>> and associate the artifacts (like the beans/binding files in case of
>> jaxws)
>>
>> And the java2cs should also generate the configuration files, right?
>> (spring, servlet etc.), and also we need have the ant tasks, so
>> generating artifacts, and then compile, deploy, all in one command.
>>
>> All in all, looks a good plan :)
>>
>> James
>>
>>> 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
>
Re: Code first tool proposal
Posted by Johnson Ma <jo...@iona.com>.
If you are going to generate the configuration file, we would like the same
function to be added back to
wsdl2java tool as well.
Johnson
----- Original Message -----
From: "James Mao" <ja...@iona.com>
To: <cx...@incubator.apache.org>
Sent: Wednesday, July 25, 2007 11:26 AM
Subject: Re: Code first tool proposal
> Excellent work, Jim,
>
> If you can also comment on the relationship between the java2wsdl and
> java2cs, that will be great
> IMHO, the java2wsdl does support the jaxws, and simple frontend, but it's
> only generate the wsdl, is it the duplicate function in the java2cs,
> Or is it possible to extend the java2wsdl (we need to find a better name
> for it)
> Or java2cs will call into the java2wsdl to generate the wsdl files, and
> associate the artifacts (like the beans/binding files in case of jaxws)
>
> And the java2cs should also generate the configuration files, right?
> (spring, servlet etc.), and also we need have the ant tasks, so generating
> artifacts, and then compile, deploy, all in one command.
>
> All in all, looks a good plan :)
>
> James
>
>> 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
Re: Code first tool proposal
Posted by Jim Ma <em...@iona.com>.
James,
Thank you for your thoughts and insights .
> IMHO, the java2wsdl does support the jaxws, and simple frontend, but
> it's only generate the wsdl, is it the duplicate function in the java2cs,
> Or is it possible to extend the java2wsdl (we need to find a better
> name for it)
> Or java2cs will call into the java2wsdl to generate the wsdl files,
> and associate the artifacts (like the beans/binding files in case of
> jaxws)
Agreed . I do not plan to rewrite these function that java2wsdl and
wsdl2java can provided . Java2cs tool can internally invoke java2wsdl
and wsdl2java
to generate client ,server wsdl for jaxws frontend .
> And the java2cs should also generate the configuration files, right?
> (spring, servlet etc.), and also we need have the ant tasks, so
> generating artifacts, and then compile, deploy, all in one command.
Great idea! I will add three options for java2cs :
-servlet-config
-ant
-all
Regards
Jim
RE: Code first tool proposal
Posted by "Liu, Jervis" <jl...@iona.com>.
Cool! This is definitely something we want. Only thing confused me is, same as James, how this java2cs (we probably want a better name, such as java2webservices, but lets use this name for the following discussion) relates to java2wsdl, when I should use java2wsdl and when I use java2cs. java2wsdl and java2cs will have a lot functionalities overlapped, which is fine, users are free to choose different tools to achieve same need, but to avoid any confusions, I think we really need to take a closer look and makes it clear on how these tools are supposed to be used. To get started, I would like to identify our use cases/scenarios and exam how java2cs and java2wsdl can be used under each scenario.
The use case for java2cs:
For a code-first approach, I will start with three things normally: a bunch of POJOs or type classes (eg, JAXB type class, object factory etc); business interface (plain java or JAX-WS SEI); impl class (plain java or Jax-ws impl class). What I want is quickly turning those classes into a runnable or deployable web services bundle. During this process, I may or may not care about the WSDL.
In this case, a usage of java2cs looks like below is enough for me:
java2cs -cp -client -server -frontend -databinding –binding (i.e, xml binding or soap binding) –wsdl -spring -ant
I can see the how much benefit I can get from using java2cs. Run one command, then everything is ready to go. BTW, I think the generation of server main class is exclusive to the generation of spring configuration. If I am going to run my cxf web serivce in a spring container, I don’t really need java main class.
The use case for java2wsdl:
This is where the headache comes from. With the presence of javatocs, why I still want to use java2wsdl? Generating a WSDL does not do any good to me anyway, at the end of day, it is the deployable or runnable service what I really want. The reason why javatowsdl is there is because without java2cs, to do a code-first development I have to call ava2wsdl first, then I need to either write server main class or spring config by myself, or I need to run wsdl2java based on generated WSDL. Shouldn’t we merge java2cs and javatowsdl into one tool, so javatowsdl essentially is equal to java2cs –wsdl? I understand javatowsdl has a lot of extras flags that allow you to customize WSDL generation, but we should have no problem to include these flags in java2cs as well, if the ultimate goal of javatocs is to allow you generate web services in one go (i.e., as simple as possible) and at the same time allow you to customize how your web service is published (i.e., as powerful as possible). Unless someone can identify a use case of java2wsdl that is different from code-first, I would say it is justified to merge javatowsdl into java2cs. Thoughts?
Cheers,
Jervis
-----Original Message-----
From: James Mao [mailto:james.mao@iona.com]
Sent: 2007?7?25? 11:26
To: cxf-dev@incubator.apache.org
Subject: Re: Code first tool proposal
Excellent work, Jim,
If you can also comment on the relationship between the java2wsdl and
java2cs, that will be great
IMHO, the java2wsdl does support the jaxws, and simple frontend, but
it's only generate the wsdl, is it the duplicate function in the java2cs,
Or is it possible to extend the java2wsdl (we need to find a better name
for it)
Or java2cs will call into the java2wsdl to generate the wsdl files, and
associate the artifacts (like the beans/binding files in case of jaxws)
And the java2cs should also generate the configuration files, right?
(spring, servlet etc.), and also we need have the ant tasks, so
generating artifacts, and then compile, deploy, all in one command.
All in all, looks a good plan :)
James
> 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
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Code first tool proposal
Posted by James Mao <ja...@iona.com>.
Excellent work, Jim,
If you can also comment on the relationship between the java2wsdl and
java2cs, that will be great
IMHO, the java2wsdl does support the jaxws, and simple frontend, but
it's only generate the wsdl, is it the duplicate function in the java2cs,
Or is it possible to extend the java2wsdl (we need to find a better name
for it)
Or java2cs will call into the java2wsdl to generate the wsdl files, and
associate the artifacts (like the beans/binding files in case of jaxws)
And the java2cs should also generate the configuration files, right?
(spring, servlet etc.), and also we need have the ant tasks, so
generating artifacts, and then compile, deploy, all in one command.
All in all, looks a good plan :)
James
> 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