org.apache.cxf.transport.DestinationFactoryManager Java Examples
The following examples show how to use
org.apache.cxf.transport.DestinationFactoryManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MAPAggregatorImpl.java From cxf with Apache License 2.0 | 6 votes |
/** * @param address the address * @return a Destination for the address */ private Destination getDestination(Bus bus, String address, Message message) throws IOException { Destination destination = null; DestinationFactoryManager factoryManager = bus.getExtension(DestinationFactoryManager.class); DestinationFactory factory = factoryManager.getDestinationFactoryForUri(address); if (factory != null) { Endpoint ep = message.getExchange().getEndpoint(); EndpointInfo ei = new EndpointInfo(); ei.setName(new QName(ep.getEndpointInfo().getName().getNamespaceURI(), ep.getEndpointInfo().getName().getLocalPart() + ".decoupled")); ei.setAddress(address); destination = factory.getDestination(ei, bus); Conduit conduit = ContextUtils.getConduit(null, message); if (conduit != null) { MessageObserver ob = conduit.getMessageObserver(); ob = new InterposedMessageObserver(bus, ob); destination.setMessageObserver(ob); } } return destination; }
Example #2
Source File: SpringBusFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testKnownExtensions() throws BusException { Bus bus = new SpringBusFactory().createBus(); assertNotNull(bus); checkBindingExtensions(bus); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); assertNotNull("No destination factory manager", dfm); ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class); assertNotNull("No conduit initiator manager", cim); checkTransportFactories(bus); checkOtherCoreExtensions(bus); //you should include instumentation extenstion to get the instrumentation manager assertNotNull("No instrumentation manager", bus.getExtension(InstrumentationManager.class)); bus.shutdown(true); }
Example #3
Source File: SpringBusFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
private void checkHTTPTransportFactories(Bus bus) throws BusException { ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class); assertNotNull("No conduit initiator manager", cim); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/http")); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/http/")); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/http/configuration")); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); assertNotNull("No destination factory manager", dfm); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http")); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/http/")); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration")); }
Example #4
Source File: JettyHTTPServerEngineFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
/** * This test makes sure that a default Spring initialized bus will * have the JettyHTTPServerEngineFactory (absent of <httpj:engine-factory> * configuration. */ @Test public void testMakeSureTransportFactoryHasEngineFactory() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. DestinationFactoryManager destFM = bus.getExtension(DestinationFactoryManager.class); assertNotNull("Cannot get DestinationFactoryManager", destFM); DestinationFactory destF = destFM.getDestinationFactory( "http://cxf.apache.org/transports/http"); assertNotNull("No DestinationFactory", destF); assertTrue(HTTPTransportFactory.class.isInstance(destF)); // And the JettyHTTPServerEngineFactory should be there. JettyHTTPServerEngineFactory factory = bus.getExtension(JettyHTTPServerEngineFactory.class); assertNotNull("EngineFactory is not configured.", factory); }
Example #5
Source File: UndertowHTTPServerEngineFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
/** * This test makes sure that a default Spring initialized bus will * have the UndertowHTTPServerEngineFactory (absent of <httpu:engine-factory> * configuration. */ @Test public void testMakeSureTransportFactoryHasEngineFactory() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. DestinationFactoryManager destFM = bus.getExtension(DestinationFactoryManager.class); assertNotNull("Cannot get DestinationFactoryManager", destFM); DestinationFactory destF = destFM.getDestinationFactory( "http://cxf.apache.org/transports/http"); assertNotNull("No DestinationFactory", destF); assertTrue(HTTPTransportFactory.class.isInstance(destF)); // And the UndertowHTTPServerEngineFactory should be there. UndertowHTTPServerEngineFactory factory = bus.getExtension(UndertowHTTPServerEngineFactory.class); assertNotNull("EngineFactory is not configured.", factory); }
Example #6
Source File: ConfiguredEndpointTest.java From cxf with Apache License 2.0 | 6 votes |
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); }
Example #7
Source File: AbstractServiceFactory.java From cxf with Apache License 2.0 | 6 votes |
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable th) { //ignore } } } if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } return null; }
Example #8
Source File: NettyHttpServerEngineFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testTransportFactoryHasEngineFactory() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. DestinationFactoryManager destFM = bus.getExtension(DestinationFactoryManager.class); assertNotNull("Cannot get DestinationFactoryManager", destFM); DestinationFactory destF = destFM.getDestinationFactory( "http://cxf.apache.org/transports/http"); assertNotNull("No DestinationFactory", destF); assertTrue(HTTPTransportFactory.class.isInstance(destF)); NettyHttpServerEngineFactory factory = bus.getExtension(NettyHttpServerEngineFactory.class); assertNotNull("EngineFactory is not configured.", factory); }
Example #9
Source File: ServerFactoryBean.java From cxf with Apache License 2.0 | 6 votes |
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable th) { //ignore } } } if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } return null; }
Example #10
Source File: WSDLServiceBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
private void buildService(QName endpointName) throws Exception { control = EasyMock.createNiceControl(); bus = control.createMock(Bus.class); bindingFactoryManager = control.createMock(BindingFactoryManager.class); destinationFactoryManager = control.createMock(DestinationFactoryManager.class); DestinationFactory destinationFactory = control.createMock(DestinationFactory.class); WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus); EasyMock.expect(bus.getExtension(BindingFactoryManager.class)) .andReturn(bindingFactoryManager).anyTimes(); EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)) .andReturn(destinationFactoryManager).atLeastOnce(); EasyMock.expect(destinationFactoryManager .getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")) .andReturn(destinationFactory).anyTimes(); control.replay(); serviceInfos = wsdlServiceBuilder.buildServices(def, service, endpointName); if (!serviceInfos.isEmpty()) { serviceInfo = serviceInfos.get(0); } else { serviceInfo = null; } }
Example #11
Source File: SoapTransportFactory.java From cxf with Apache License 2.0 | 5 votes |
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; } }
Example #12
Source File: WebSocketDestinationFactory.java From cxf with Apache License 2.0 | 5 votes |
private static DestinationRegistry getDestinationRegistry(Bus bus) { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { DestinationFactory df = dfm .getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); if (df instanceof HTTPTransportFactory) { HTTPTransportFactory transportFactory = (HTTPTransportFactory)df; return transportFactory.getRegistry(); } } catch (Exception e) { // why are we throwing a busexception if the DF isn't found? } return null; }
Example #13
Source File: CXFNonSpringServlet.java From cxf with Apache License 2.0 | 5 votes |
protected DestinationRegistry getDestinationRegistryFromBusOrDefault(final String transportId) { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { String peferredTransportId = transportId; // Check if the preferred transport is set on a bus level (f.e., from any // extension or customization). if (StringUtils.isEmpty(peferredTransportId) && getBus() != null) { peferredTransportId = (String)getBus().getProperty(AbstractTransportFactory.PREFERRED_TRANSPORT_ID); } if (StringUtils.isEmpty(peferredTransportId)) { final Set<String> candidates = dfm.getRegisteredDestinationFactoryNames(); // If the default transport is present, fall back to it and don't even // consider other candidates if (!candidates.contains(DEFAULT_TRANSPORT_ID)) { peferredTransportId = candidates .stream() .filter(name -> name.endsWith("/configuration")) .findAny() .orElse(DEFAULT_TRANSPORT_ID); } } DestinationFactory df = StringUtils.isEmpty(peferredTransportId) ? dfm.getDestinationFactory(DEFAULT_TRANSPORT_ID) : dfm.getDestinationFactory(peferredTransportId); if (df instanceof HTTPTransportFactory) { HTTPTransportFactory transportFactory = (HTTPTransportFactory)df; return transportFactory.getRegistry(); } } catch (BusException e) { // why are we throwing a busexception if the DF isn't found? } return null; }
Example #14
Source File: SyncopeServiceImpl.java From syncope with Apache License 2.0 | 5 votes |
private DestinationRegistry getDestinationRegistryFromBusOrDefault() { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { HTTPTransportFactory df = (HTTPTransportFactory) dfm. getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); return df.getRegistry(); } catch (Exception e) { throw new InternalServerErrorException("Could not find CXF's DestinationRegistry", e); } }
Example #15
Source File: ServiceWSDLBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
private void setupWSDL(String wsdlPath, boolean doXsdImports) throws Exception { String wsdlUrl = getClass().getResource(wsdlPath).toString(); LOG.info("the path of wsdl file is " + wsdlUrl); WSDLFactory wsdlFactory = WSDLFactory.newInstance(); WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); wsdlReader.setFeature("javax.wsdl.verbose", false); def = wsdlReader.readWSDL(wsdlUrl); control = EasyMock.createNiceControl(); bus = control.createMock(Bus.class); bindingFactoryManager = control.createMock(BindingFactoryManager.class); destinationFactoryManager = control.createMock(DestinationFactoryManager.class); destinationFactory = control.createMock(DestinationFactory.class); wsdlServiceBuilder = new WSDLServiceBuilder(bus, false); for (Service serv : CastUtils.cast(def.getServices().values(), Service.class)) { if (serv != null) { service = serv; break; } } EasyMock.expect(bus.getExtension(WSDLManager.class)).andReturn(new WSDLManagerImpl()).anyTimes(); EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager); EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)) .andReturn(destinationFactoryManager); EasyMock.expect(destinationFactoryManager .getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")) .andReturn(destinationFactory); control.replay(); serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0); ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, serviceInfo); builder.setUseSchemaImports(doXsdImports); builder.setBaseFileName("HelloWorld"); newDef = builder.build(new HashMap<String, SchemaInfo>()); }
Example #16
Source File: DestinationFactoryManagerImpl.java From cxf with Apache License 2.0 | 5 votes |
@Resource public void setBus(Bus b) { bus = b; if (null != bus) { bus.setExtension(this, DestinationFactoryManager.class); } }
Example #17
Source File: SpringBusFactoryTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testDefault() { Bus bus = new SpringBusFactory().createBus(); assertNotNull(bus); BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class); assertNotNull("No binding factory manager", bfm); assertNotNull("No configurer", bus.getExtension(Configurer.class)); assertNotNull("No resource manager", bus.getExtension(ResourceManager.class)); assertNotNull("No destination factory manager", bus.getExtension(DestinationFactoryManager.class)); assertNotNull("No conduit initiator manager", bus.getExtension(ConduitInitiatorManager.class)); assertNotNull("No phase manager", bus.getExtension(PhaseManager.class)); assertNotNull("No workqueue manager", bus.getExtension(WorkQueueManager.class)); assertNotNull("No lifecycle manager", bus.getExtension(BusLifeCycleManager.class)); assertNotNull("No service registry", bus.getExtension(ServerRegistry.class)); try { bfm.getBindingFactory("http://cxf.apache.org/unknown"); } catch (BusException ex) { // expected } assertEquals("Unexpected interceptors", 0, bus.getInInterceptors().size()); assertEquals("Unexpected interceptors", 0, bus.getInFaultInterceptors().size()); assertEquals("Unexpected interceptors", 0, bus.getOutInterceptors().size()); assertEquals("Unexpected interceptors", 0, bus.getOutFaultInterceptors().size()); }
Example #18
Source File: CXFBusImplTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testConstructionWithoutExtensions() throws BusException { Bus bus = new ExtensionManagerBus(); assertNotNull(bus.getExtension(BindingFactoryManager.class)); assertNotNull(bus.getExtension(ConduitInitiatorManager.class)); assertNotNull(bus.getExtension(DestinationFactoryManager.class)); assertNotNull(bus.getExtension(PhaseManager.class)); bus.shutdown(true); }
Example #19
Source File: GenericWebServiceServlet.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
private static DestinationRegistry getDestinationRegistryFromBus(Bus bus) { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); if (df instanceof HTTPTransportFactory) { HTTPTransportFactory transportFactory = (HTTPTransportFactory) df; return transportFactory.getRegistry(); } } catch (BusException e) { // why are we throwing a busexception if the DF isn't found? } return null; }
Example #20
Source File: ProtobufServerFactoryBean.java From fuchsia with Apache License 2.0 | 5 votes |
protected EndpointInfo createEndpointInfo() throws BusException { String transportId = getTransportId(); if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); } if (df != null) { transportId = df.getTransportIds().get(0); } } // default to http transport if (transportId == null) { transportId = "http://schemas.xmlsoap.org/wsdl/soap/http"; } setTransportId(transportId); EndpointInfo ei = new EndpointInfo(); ei.setTransportId(transportId); ei.setName(serviceFactory.getService().getName()); ei.setAddress(getAddress()); ei.setProperty(PROTOBUF_MESSAGE_CLASS, messageClass); BindingInfo bindingInfo = createBindingInfo(); ei.setBinding(bindingInfo); return ei; }
Example #21
Source File: AbstractJaxWsTest.java From cxf with Apache License 2.0 | 5 votes |
@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); }
Example #22
Source File: CxfExtractor.java From component-runtime with Apache License 2.0 | 5 votes |
public DestinationRegistry getRegistry() { try { final HTTPTransportFactory transportFactory = HTTPTransportFactory.class .cast(bus .getExtension(DestinationFactoryManager.class) .getDestinationFactory("http://cxf.apache.org/transports/http" + "/configuration")); return transportFactory.getRegistry(); } catch (final BusException e) { throw new IllegalStateException(e); } }
Example #23
Source File: MtomServerTest.java From cxf with Apache License 2.0 | 5 votes |
private void unregisterServStatic(String add) throws Exception { Bus bus = getStaticBus(); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); DestinationFactory df = dfm .getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); EndpointInfo ei = new EndpointInfo(); ei.setAddress(add); Destination d = df.getDestination(ei, bus); d.setMessageObserver(null); }
Example #24
Source File: JaxwsServiceBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { JAXBContextCache.clearCaches(); builder = new JaxwsServiceBuilder(); builder.setBus(BusFactory.getDefaultBus()); generator.setBus(builder.getBus()); generator.setToolContext(new ToolContext()); Bus b = builder.getBus(); assertNotNull(b.getExtension(DestinationFactoryManager.class) .getDestinationFactory("http://schemas.xmlsoap.org/soap/http")); }
Example #25
Source File: AbstractAegisTest.java From cxf with Apache License 2.0 | 5 votes |
@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); }
Example #26
Source File: JAXBDataBindingTest.java From cxf with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { jaxbDataBinding = new JAXBDataBinding(); String wsdlUrl = getClass().getResource(WSDL_PATH).toString(); LOG.info("the path of wsdl file is " + wsdlUrl); WSDLFactory wsdlFactory = WSDLFactory.newInstance(); WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); wsdlReader.setFeature("javax.wsdl.verbose", false); def = wsdlReader.readWSDL(wsdlUrl); control = EasyMock.createNiceControl(); bus = control.createMock(Bus.class); bindingFactoryManager = control.createMock(BindingFactoryManager.class); destinationFactoryManager = control.createMock(DestinationFactoryManager.class); EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andStubReturn(bindingFactoryManager); EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)) .andStubReturn(destinationFactoryManager); control.replay(); WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus); for (Service serv : CastUtils.cast(def.getServices().values(), Service.class)) { if (serv != null) { service = serv; break; } } wsdlServiceBuilder.buildServices(def, service); }
Example #27
Source File: ServerFactoryBean.java From cxf with Apache License 2.0 | 5 votes |
@Override protected String detectTransportIdFromAddress(String ad) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); if (df != null) { return df.getTransportIds().get(0); } } return null; }
Example #28
Source File: AbstractWSDLBasedEndpointFactory.java From cxf with Apache License 2.0 | 5 votes |
private void modifyTransportIdPerAddress(EndpointInfo ei) { //get chance to set transportId according to the the publish address prefix //this is useful for local & camel transport if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension( DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); } if (df != null) { transportId = df.getTransportIds().get(0); } else { // check conduits (the address could be supported on // client only) ConduitInitiatorManager cim = getBus().getExtension( ConduitInitiatorManager.class); ConduitInitiator ci = cim .getConduitInitiatorForUri(getAddress()); if (ci != null) { transportId = ci.getTransportIds().get(0); } } } if (transportId != null) { ei.setTransportId(transportId); } }
Example #29
Source File: AbstractSimpleFrontendTest.java From cxf with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { super.setUpBus(); Bus bus = getBus(); SoapBindingFactory bindingFactory = new SoapBindingFactory(); bus.getExtension(BindingFactoryManager.class) .registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); SoapTransportFactory soapTF = new SoapTransportFactory(); dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapTF); dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapTF); LocalTransportFactory localTransport = new LocalTransportFactory(); localTransport.getUriPrefixes().add("http"); dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport); dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport); ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class); extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport); extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport); extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport); extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", soapTF); }
Example #30
Source File: AbstractJAXRSFactoryBean.java From cxf with Apache License 2.0 | 5 votes |
protected EndpointInfo createEndpointInfo(Service service) throws BusException { String transportId = getTransportId(); if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); super.setDestinationFactory(df); } if (df != null) { transportId = df.getTransportIds().get(0); } } //default to http transport if (transportId == null) { transportId = "http://cxf.apache.org/transports/http"; } setTransportId(transportId); //EndpointInfo ei = new EndpointInfo(service.getServiceInfos().get(0), transportId); EndpointInfo ei = new EndpointInfo(); ei.setTransportId(transportId); ei.setName(serviceFactory.getService().getName()); ei.setAddress(getAddress()); BindingInfo bindingInfo = createBindingInfo(); ei.setBinding(bindingInfo); if (!StringUtils.isEmpty(publishedEndpointUrl)) { ei.setProperty("publishedEndpointUrl", publishedEndpointUrl); } ei.setName(service.getName()); serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINTINFO_CREATED, ei); return ei; }