use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.
the class SoapTransportFactory method getDestination.
public Destination getDestination(EndpointInfo ei, Bus bus) throws IOException {
String address = ei.getAddress();
BindingInfo bi = ei.getBinding();
String transId = ei.getTransportId();
if (bi instanceof SoapBindingInfo) {
transId = ((SoapBindingInfo) bi).getTransportURI();
if (transId == null) {
transId = ei.getTransportId();
}
}
DestinationFactory destinationFactory;
try {
DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
if (StringUtils.isEmpty(address) || address.startsWith("http") || address.startsWith("jms") || address.startsWith("soap.udp") || address.startsWith("/")) {
destinationFactory = mgr.getDestinationFactory(mapTransportURI(transId, address));
} else {
destinationFactory = mgr.getDestinationFactoryForUri(address);
}
if (destinationFactory == null) {
throw new IOException("Could not find destination factory for transport " + transId);
}
return destinationFactory.getDestination(ei, bus);
} catch (BusException e) {
IOException ex = new IOException("Could not find destination factory for transport " + transId);
ex.initCause(e);
throw ex;
}
}
use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.
the class AbstractAegisTest method setUp.
@Before
public void setUp() throws Exception {
super.setUpBus();
SoapBindingFactory bindingFactory = new SoapBindingFactory();
bindingFactory.setBus(bus);
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
SoapTransportFactory soapDF = new SoapTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
dfm.registerDestinationFactory(SoapBindingConstants.SOAP11_BINDING_ID, soapDF);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", soapDF);
localTransport = new LocalTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", localTransport);
ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", localTransport);
extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
extension.registerConduitInitiator(SoapBindingConstants.SOAP11_BINDING_ID, localTransport);
bus.setExtension(new WSDLManagerImpl(), WSDLManager.class);
// WoodstoxValidationImpl wstxVal = new WoodstoxValidationImpl();
addNamespace("wsdl", WSDLConstants.NS_WSDL11);
addNamespace("wsdlsoap", WSDLConstants.NS_SOAP11);
addNamespace("xsd", WSDLConstants.NS_SCHEMA_XSD);
}
use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.
the class AbstractJaxWsTest method setUpBus.
@Before
public void setUpBus() throws Exception {
super.setUpBus();
SoapBindingFactory bindingFactory = new SoapBindingFactory();
bindingFactory.setBus(bus);
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/http", bindingFactory);
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
SoapTransportFactory soapDF = new SoapTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
dfm.registerDestinationFactory(SoapBindingConstants.SOAP11_BINDING_ID, soapDF);
dfm.registerDestinationFactory(SoapBindingConstants.SOAP12_BINDING_ID, soapDF);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", soapDF);
localTransport = new LocalTransportFactory();
localTransport.setUriPrefixes(new HashSet<>(Arrays.asList("http", "local")));
dfm.registerDestinationFactory(LocalTransportFactory.TRANSPORT_ID, localTransport);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/http", localTransport);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/http/configuration", localTransport);
ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
extension.registerConduitInitiator("http://cxf.apache.org/transports/http", localTransport);
extension.registerConduitInitiator("http://cxf.apache.org/transports/http/configuration", localTransport);
}
use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.
the class ConfiguredEndpointTest method initializeBus.
private void initializeBus() {
Bus bus = BusFactory.getDefaultBus();
SoapBindingFactory bindingFactory = new SoapBindingFactory();
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
SoapTransportFactory soapDF = new SoapTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapDF);
LocalTransportFactory localTransport = new LocalTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
}
use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.
the class ServiceImpl method createEndpointInfo.
private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean serviceFactory, QName portName, PortInfoImpl portInfo) throws BusException {
EndpointInfo ei = null;
String address = portInfo.getAddress();
String bindingID = BindingID.getBindingID(portInfo.getBindingID());
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
// the bindingId might be the transportId, just attempt to
// load it to force the factory to load
dfm.getDestinationFactory(bindingID);
} catch (BusException ex) {
// ignore
}
DestinationFactory df = dfm.getDestinationFactoryForUri(address);
String transportId = null;
if (df != null && df.getTransportIds() != null && !df.getTransportIds().isEmpty()) {
transportId = df.getTransportIds().get(0);
} else {
transportId = bindingID;
}
Object config = null;
if (serviceFactory instanceof JaxWsServiceFactoryBean) {
config = new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean) serviceFactory);
}
BindingInfo bindingInfo = bus.getExtension(BindingFactoryManager.class).getBindingFactory(bindingID).createBindingInfo(serviceFactory.getService(), bindingID, config);
Service service = serviceFactory.getService();
service.getServiceInfos().get(0).addBinding(bindingInfo);
ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);
ei.setName(portName);
ei.setAddress(address);
ei.setBinding(bindingInfo);
service.getServiceInfos().get(0).addEndpoint(ei);
return ei;
}
Aggregations