Return-Path: Delivered-To: apmail-incubator-cxf-dev-archive@locus.apache.org Received: (qmail 32269 invoked from network); 25 Jul 2007 03:27:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jul 2007 03:27:34 -0000 Received: (qmail 19076 invoked by uid 500); 25 Jul 2007 03:27:35 -0000 Delivered-To: apmail-incubator-cxf-dev-archive@incubator.apache.org Received: (qmail 19030 invoked by uid 500); 25 Jul 2007 03:27:35 -0000 Mailing-List: contact cxf-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-dev@incubator.apache.org Received: (qmail 19021 invoked by uid 99); 25 Jul 2007 03:27:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jul 2007 20:27:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of james.mao@iona.com designates 12.170.54.180 as permitted sender) Received: from [12.170.54.180] (HELO amer-mx1.iona.com) (12.170.54.180) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jul 2007 20:27:31 -0700 X-IronPort-AV: E=Sophos;i="4.16,577,1175486400"; d="scan'208";a="3351876" Received: from amer-ems1.ionaglobal.com ([10.65.6.25]) by amer-mx1.iona.com with ESMTP; 24 Jul 2007 23:27:09 -0400 Received: from [10.129.9.178] ([10.129.9.178]) by amer-ems1.IONAGLOBAL.COM with Microsoft SMTPSVC(6.0.3790.1830); Tue, 24 Jul 2007 23:27:04 -0400 Message-ID: <46A6C2DF.1040709@iona.com> Date: Wed, 25 Jul 2007 11:26:23 +0800 From: James Mao User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: cxf-dev@incubator.apache.org Subject: Re: Code first tool proposal References: <46A6BB63.2040909@iona.com> In-Reply-To: <46A6BB63.2040909@iona.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 25 Jul 2007 03:27:06.0057 (UTC) FILETIME=[ACE09390:01C7CE6B] X-Virus-Checked: Checked by ClamAV on apache.org 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