更改CXF ServiceInfo中的端点详细信息



环境CXF2.2.6和spring2.5。在启动JBOSS时,我需要读取CXF属性并更改端点详细信息。从基本的阅读来看,它给我的想法是CXF服务信息类(org.apache.cxf.service.model.ServiceInfo)处理绑定、端点、消息、模式等。

我可以扩展CXFServlet并创建自己的定制servlet。请告诉我如何在启动时为端点提供自己的详细信息并覆盖Spring.xml

中给出的内容
The below Spring bean should do what you wanted. Why do you want to override  ServiceInfo class ? Any particular reason ?
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ServletContextAware;

public class CXFConfig implements InitializingBean{
    @Autowired
    Bus cxfBus;
    @Override
    public void afterPropertiesSet() throws Exception {
        EndpointImpl endpoint = new EndpointImpl(cxfBus, new GdsAutomationServiceProviderImpl());
        endpoint.setAddress("/public/api/service/v1");//WSDL URL
        endpoint.setPublishedEndpointUrl(getEndPointAddress());
        endpoint.publish();
    }
    public Bus getCxfBus() {
        return cxfBus;
    }
    public void setCxfBus(Bus cxfBus) {
        this.cxfBus = cxfBus;
    }

    public String getEndPointAddress() {
      //  Soap address location you need to define here
        return "address"
    }
    @Override
    public void setServletContext(ServletContext context) {
        context.getServerInfo();
    }
}

相关内容

最新更新