1 17 package org.apache.geronimo.cxf; 18 19 import org.apache.cxf.Bus; 20 import org.apache.cxf.binding.xml.XMLConstants; 21 import org.apache.cxf.jaxws.EndpointImpl; 22 import org.apache.cxf.transport.DestinationFactory; 23 import org.apache.cxf.transport.DestinationFactoryManager; 24 import org.apache.geronimo.webservices.WebServiceContainer; 25 26 public class CXFWebServiceContainer implements WebServiceContainer { 28 29 private final GeronimoDestination destination; 30 private final Bus bus; 31 32 33 public CXFWebServiceContainer(PortInfo portInfo, Object target, Bus bus) { 34 this.bus = bus; 36 DestinationFactoryManager destinationFactoryManager = bus.getExtension(DestinationFactoryManager.class); 37 DestinationFactory factory = new GeronimoDestinationFactory(bus); 38 destinationFactoryManager.registerDestinationFactory("http://cxf.apache.org/transports/http/configuration", factory); 39 destinationFactoryManager.registerDestinationFactory("http://www.w3.org/2003/05/soap/bindings/HTTP/", factory); 40 destinationFactoryManager.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", factory); 41 destinationFactoryManager.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/http/", factory); 42 destinationFactoryManager.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", factory); 43 destinationFactoryManager.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", factory); 44 destinationFactoryManager.registerDestinationFactory(XMLConstants.NS_XML_FORMAT, factory); 45 EndpointImpl publishedEndpoint = publishEndpoint(target); 46 destination = (GeronimoDestination) publishedEndpoint.getServer().getDestination(); 47 } 48 49 public void invoke(Request request, Response response) throws Exception { 50 51 destination.invoke(request, response); 52 } 53 54 55 public void getWsdl(Request request, Response response) throws Exception { 56 } 57 58 private EndpointImpl publishEndpoint(Object target) { 59 60 assert target != null : "null target received"; 61 62 EndpointImpl ep = new EndpointImpl(bus, target, (String )null); 63 ep.publish("http://nopath"); 64 return ep; 65 66 } 67 68 } 69 | Popular Tags |