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, String route) { return create(implementor, service, route, null); } public Endpoint create(Object implementor, Service service, String route, Interceptor interceptor) { EndpointImpl endpoint = new EndpointImpl(bus, implementor); endpoint.setAddress(route); endpoint.setServiceName(service.getServiceName()); endpoint.setWsdlLocation(service.getWSDLDocumentLocation().toString()); endpoint.publish(); if (interceptor != null) { endpoint.getInInterceptors().add(interceptor); } return endpoint; } }