With the CXFNonSpringServlet, it can be done, but the coding is much more complex/cumbersome. We have a recent JIRA asking for more annotations to allow development without a cxf-servlet.xml.

I found your reasoning "Well, I just don't like using xml to config everything as any change would force redeploy of web app hosting the webservice" curious -- I dare say you'd have the same problem with a Java file, even more as a matter of fact because it, unlike the XML file, would need to be compiled. Besides that matter, an XML file is no different from a Java file, it's all syntax, using < >'s instead of { } and ;, etc.

My WSDL-first tutorial, with only a tiny cxf-servlet.xml file may be of help for you: http://www.jroller.com/gmazza/entry/web_service_tutorial

Glen

On 01/14/2013 04:19 AM, Sam777 wrote:
Hi there,

Excuse me a newbie question.

Am I right to assume that a production web app using cxf for webservice can
get away without using cxf.xml at all?

As I read it in  Configuration using Java code
<http://cxf.apache.org/docs/bus-configuration.html>  . The page basically
shows that the bus can be obtained from endpoint, hence do away with xml
config.

        /import javax.xml.ws.Endpoint;
        import org.apache.cxf.interceptor.LoggingInInterceptor;
        import org.apache.cxf.interceptor.LoggingOutInterceptor;
        import org.apache.cxf.jaxws.EndpointImpl;

        Object implementor = new GreeterImpl();
        EndpointImpl ep = (EndpointImpl)
Endpoint.publish("http://localhost/service";, implementor);

        ep.getServiceFactory().getBus().getInInterceptors().add(new
LoggingInInterceptor());
        ep.getServiceFactory().getBus().getOutInterceptors().add(new
LoggingOutInterceptor());/

Is that a bad practice or idea for production? Funny enough, nobody seems to
have asked this before here.

Why do I want to do this? Well, I just don't like using xml to config
everything as any change would force redeploy of web app hosting the
webservice.

To me, flexibility far outweighs the extra java code xml config files can
save you from typing.

Thanks

Sam




--
View this message in context: 
http://cxf.547215.n5.nabble.com/Configuration-using-Java-code-without-cxf-xml-tp5721528.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza

Reply via email to