package at.gv.egiz.moazs.util; import org.apache.cxf.Bus; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.message.Message; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.xml.ws.Endpoint; import javax.xml.ws.Service; @Component public class EndpointFactory { private final Bus bus; @Autowired public EndpointFactory(Bus bus) { this.bus = bus; } public Endpoint create(Object implementor, Service service) { return create(implementor, service, null); } public Endpoint create(Object implementor, Service service, Interceptor interceptor) { EndpointImpl endpoint = new EndpointImpl(bus, implementor); endpoint.setAddress("/"); endpoint.setServiceName(service.getServiceName()); endpoint.setWsdlLocation(service.getWSDLDocumentLocation().toString()); endpoint.publish(); if (interceptor != null) { endpoint.getInInterceptors().add(interceptor); } return endpoint; } }