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" <[EMAIL PROTECTED]> > To: <[email protected]> > 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 [EMAIL PROTECTED] http://www.dankulp.com/blog
