JAX-WS Web service on Tomcat without sun-jaxws.xml

前端 未结 4 2097
礼貌的吻别
礼貌的吻别 2021-02-13 12:02

I am trying to minimize required configuration while deploying JAX-WS-based Web service on Tomcat. With the introduction of Servlet 3.0 (supported by Tomcat 7+), web.xml

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-13 13:00

    I have publised web services successfully by this way. I have used apache cfx for publishing in servletContextListener.

    @WebListener
    public class WebServicePublisListener implements ServletContextListener {
    
        /**
         * Default constructor. 
         */
        public WebServicePublisListener() {
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @see ServletContextListener#contextInitialized(ServletContextEvent)
         */
        public void contextInitialized(ServletContextEvent sce)  { 
            JaxWsServerFactoryBean srvFactory = new JaxWsServerFactoryBean();
            srvFactory.setServiceClass(RandService.class);
            srvFactory.setAddress("/RandService");
            srvFactory.setServiceBean(new RandServiceImplement());
            srvFactory.create();
        }
    

提交回复
热议问题