Search in sources :

Example 1 with LocalTransportFactory

use of org.apache.cxf.transport.local.LocalTransportFactory in project cxf by apache.

the class PolicyAnnotationTest method testAnnotationImplNoInterface.

@org.junit.Test
public void testAnnotationImplNoInterface() throws Exception {
    Bus bus = BusFactory.getDefaultBus();
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceBean(new TestImplNoInterface());
    factory.setStart(false);
    List<String> tp = Arrays.asList("http://schemas.xmlsoap.org/soap/http", "http://schemas.xmlsoap.org/wsdl/http/", "http://schemas.xmlsoap.org/wsdl/soap/http", "http://www.w3.org/2003/05/soap/bindings/HTTP/", "http://cxf.apache.org/transports/http/configuration", "http://cxf.apache.org/bindings/xformat");
    LocalTransportFactory f = new LocalTransportFactory();
    f.getUriPrefixes().add("http");
    f.setTransportIds(tp);
    Server s = factory.create();
    try {
        ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, s.getEndpoint().getService().getServiceInfos());
        Definition def = builder.build();
        WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
        def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
        Element wsdl = wsdlWriter.getDocument(def).getDocumentElement();
        Map<String, String> ns = new HashMap<>();
        ns.put("wsdl", WSDLConstants.NS_WSDL11);
        ns.put("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
        ns.put("wsp", Constants.URI_POLICY_13_NS);
        XPathUtils xpu = new XPathUtils(ns);
        // org.apache.cxf.helpers.XMLUtils.printDOM(wsdl);
        assertEquals(1, xpu.getValueList("/wsdl:definitions/wsdl:binding/" + "wsp:PolicyReference[@URI='#TestImplNoInterfaceServiceSoapBindingBindingPolicy']", wsdl).getLength());
        final EndpointPolicy policy = bus.getExtension(PolicyEngine.class).getServerEndpointPolicy(s.getEndpoint().getEndpointInfo(), null, null);
        assertNotNull(policy);
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) Server(org.apache.cxf.endpoint.Server) HashMap(java.util.HashMap) LocalTransportFactory(org.apache.cxf.transport.local.LocalTransportFactory) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) PolicyEngine(org.apache.cxf.ws.policy.PolicyEngine) WSDLWriter(javax.wsdl.xml.WSDLWriter) ServiceWSDLBuilder(org.apache.cxf.wsdl11.ServiceWSDLBuilder) EndpointPolicy(org.apache.cxf.ws.policy.EndpointPolicy) XPathUtils(org.apache.cxf.helpers.XPathUtils) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 2 with LocalTransportFactory

use of org.apache.cxf.transport.local.LocalTransportFactory 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);
}
Also used : Bus(org.apache.cxf.Bus) SoapBindingFactory(org.apache.cxf.binding.soap.SoapBindingFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) LocalTransportFactory(org.apache.cxf.transport.local.LocalTransportFactory) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) SoapTransportFactory(org.apache.cxf.binding.soap.SoapTransportFactory)

Example 3 with LocalTransportFactory

use of org.apache.cxf.transport.local.LocalTransportFactory 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);
}
Also used : SoapBindingFactory(org.apache.cxf.binding.soap.SoapBindingFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) LocalTransportFactory(org.apache.cxf.transport.local.LocalTransportFactory) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) WSDLManagerImpl(org.apache.cxf.wsdl11.WSDLManagerImpl) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) SoapTransportFactory(org.apache.cxf.binding.soap.SoapTransportFactory) Before(org.junit.Before)

Example 4 with LocalTransportFactory

use of org.apache.cxf.transport.local.LocalTransportFactory 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);
}
Also used : SoapBindingFactory(org.apache.cxf.binding.soap.SoapBindingFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) LocalTransportFactory(org.apache.cxf.transport.local.LocalTransportFactory) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) SoapTransportFactory(org.apache.cxf.binding.soap.SoapTransportFactory) Before(org.junit.Before)

Example 5 with LocalTransportFactory

use of org.apache.cxf.transport.local.LocalTransportFactory in project tesb-rt-se by Talend.

the class RequestCallbackTest method initialize.

@Before
public void initialize() throws Exception {
    if (mep == NO_RUN) {
        return;
    }
    final Bus bus = BusFactory.getDefaultBus();
    final LocalTransportFactory localTransport = new LocalTransportFactory();
    final DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
    dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/jms", 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);
    final ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
    extension.registerConduitInitiator("http://cxf.apache.org/transports/local", 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/soap/jms", localTransport);
    extension.registerConduitInitiator("http://cxf.apache.org/bindings/xformat", localTransport);
    final WSDLServiceFactory wsdlSvcFactory = new WSDLServiceFactory(CXFBusFactory.getThreadDefaultBus(), wsdlLocation, SERVICE_NAME);
    final org.apache.cxf.service.Service cxfService = wsdlSvcFactory.create();
    final ServiceInfo si = findServiceByName(cxfService, SERVICE_NAME);
    if (si == null) {
        throw new RuntimeException("WSDL does not contain service " + SERVICE_NAME);
    }
    final EndpointInfo ei = findEndpoint(si, PORT_NAME);
    if (ei == null) {
        throw new RuntimeException("WSDL does not contain port " + PORT_NAME);
    }
    endpointInfo = ei;
    callbackMap.put("seekBookInBasementResponse", new SeekBookInBasementResponseCallback(messageTransfer));
    callbackMap.put("seekBookInBasementFault", new SeekBookInBasementFaultCallback(messageTransfer));
}
Also used : Bus(org.apache.cxf.Bus) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) LocalTransportFactory(org.apache.cxf.transport.local.LocalTransportFactory) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SeekBookInBasementResponseCallback(org.talend.esb.mep.requestcallback.sample.internal.SeekBookInBasementResponseCallback) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) SeekBookInBasementFaultCallback(org.talend.esb.mep.requestcallback.sample.internal.SeekBookInBasementFaultCallback) Before(org.junit.Before)

Aggregations

LocalTransportFactory (org.apache.cxf.transport.local.LocalTransportFactory)9 Bus (org.apache.cxf.Bus)7 DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)5 HashMap (java.util.HashMap)4 Definition (javax.wsdl.Definition)4 WSDLWriter (javax.wsdl.xml.WSDLWriter)4 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)4 SoapBindingFactory (org.apache.cxf.binding.soap.SoapBindingFactory)4 SoapTransportFactory (org.apache.cxf.binding.soap.SoapTransportFactory)4 Server (org.apache.cxf.endpoint.Server)4 XPathUtils (org.apache.cxf.helpers.XPathUtils)4 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)4 ConduitInitiatorManager (org.apache.cxf.transport.ConduitInitiatorManager)4 ServiceWSDLBuilder (org.apache.cxf.wsdl11.ServiceWSDLBuilder)4 Before (org.junit.Before)4 Element (org.w3c.dom.Element)4 EndpointPolicy (org.apache.cxf.ws.policy.EndpointPolicy)3 PolicyEngine (org.apache.cxf.ws.policy.PolicyEngine)3 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)1 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)1