Search in sources :

Example 61 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class JmsConfigurator method create.

public static JmsConfigurator create(Endpoint endpoint) {
    if (!(endpoint instanceof EndpointImpl)) {
        return null;
    }
    final EndpointImpl ep = (EndpointImpl) endpoint;
    final QName serviceName = ep.getServiceName();
    if (serviceName == null) {
        return null;
    }
    final QName endpointName = ep.getEndpointName();
    final String portName = endpointName == null ? null : endpointName.getLocalPart();
    JmsConfigurator result = new JmsConfigurator();
    result.setConfigurationPrefix(portName);
    result.setJmsConfiguration(new JMSConfiguration());
    result.setServiceName(serviceName);
    return result;
}
Also used : JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl)

Example 62 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class JmsEndpointConfigurator method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    final JmsUriConfigurator cfg = JmsUriConfigurator.create(endpoint);
    if (cfg == null) {
        return;
    }
    final EndpointImpl ei = (EndpointImpl) endpoint;
    CallContext.setupEndpoint(ei);
    cfg.setPresetJmsAddress(ei.getAddress());
    ei.setAddress(cfg.createJmsAddress());
    if (publishEndpoint) {
        ei.publish();
    }
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl)

Example 63 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class CallContext method setupEndpoint.

public static void setupEndpoint(final Endpoint endpoint) {
    if (!(endpoint instanceof EndpointImpl)) {
        throw new IllegalArgumentException("Only CXF JAX-WS endpoints supported. ");
    }
    final EndpointImpl ep = (EndpointImpl) endpoint;
    final List<Feature> features = new ArrayList<Feature>();
    features.add(new RequestCallbackFeature());
    if (logging) {
        features.add(new LoggingFeature());
    }
    if (serviceActivityMonitoring) {
        features.add(getEventFeature());
    }
    if (ep.getFeatures() != null) {
        features.addAll(ep.getFeatures());
    }
    ep.setFeatures(features);
    ep.getProperties().put(NULL_MEANS_ONEWAY, Boolean.TRUE);
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) LoggingFeature(org.apache.cxf.feature.LoggingFeature) ArrayList(java.util.ArrayList) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature)

Example 64 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project tesb-rt-se by Talend.

the class JmsUriConfiguratorTest method testCreateEndpoint.

@Test
public void testCreateEndpoint() {
    HelloWorldImpl implementor = new HelloWorldImpl();
    String address = "local://JmsUriConfiguratorTest";
    ep = Endpoint.publish(address, implementor);
    Assert.assertNotNull(ep);
    Assert.assertTrue(ep instanceof EndpointImpl);
    JmsUriConfigurator conf = JmsUriConfigurator.create(ep);
    Assert.assertNotNull(conf);
    JmsUriConfiguration jmsConf = conf.createJmsUriConfiguration();
    Assert.assertNotNull(jmsConf);
    System.out.println("Configurator identifier is: " + conf.getConfiguration().getConfigurationIdentifier());
    Assert.assertNotNull(conf.getConfiguration().getProperty("jndiInitialContextFactory"));
    Assert.assertEquals("org.apache.activemq.jndi.ActiveMQInitialContextFactory", conf.getConfiguration().getProperty("jndiInitialContextFactory"));
    // --------------------------------------------------------------------------------------------------
    conf.setPresetJmsAddress("jms://");
    conf.setVariant(jmsConf.getVariant());
    conf.setDefaultVariant("jndi");
    conf.setDestinationName(jmsConf.getDestinationName());
    conf.setDefaultDestinationName("defaultDestinationName");
    conf.setEndpointName("JmsUriConfiguratorTest");
    Assert.assertEquals("jms://", conf.getPresetJmsAddress());
    Assert.assertEquals("jndi", conf.getVariant());
    Assert.assertEquals("jndi", conf.getDefaultVariant());
    Assert.assertEquals("dynamicQueues/libraryprovider.queue", conf.getDestinationName());
    Assert.assertEquals("defaultDestinationName", conf.getDefaultDestinationName());
    Assert.assertEquals("jms:jndi:dynamicQueues/libraryprovider.queue?jndiConnectionFactoryName=ConnectionFactory&jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&jndiURL=tcp://localhost:61616", conf.getJmsAddress());
    Assert.assertEquals("http://internal.test.requestcallback.mep.esb.talend.org/", conf.getServiceName().getNamespaceURI());
    Assert.assertEquals("HelloWorldImplService", conf.getServiceName().getLocalPart());
    Assert.assertEquals(new QName(null, "JmsUriConfiguratorTest"), conf.getEndpointName());
    Assert.assertEquals("JmsUriConfiguratorTest", conf.getConfigurationPrefix());
    Map<String, Object> m = new HashMap<String, Object>();
    m.put("key1", "val1");
    conf.setDefaultParameters(m);
    Map m2 = conf.getDefaultParameters();
    Assert.assertNotNull(m2);
    Assert.assertEquals(1, m2.size());
    Assert.assertTrue(m2.containsKey("key1"));
    Assert.assertTrue(m2.containsValue("val1"));
    conf.setParameters(m);
    m2 = conf.getParameters();
    Assert.assertNotNull(m2);
    Assert.assertEquals(1, m2.size());
    Assert.assertTrue(m2.containsKey("key1"));
    Assert.assertTrue(m2.containsValue("val1"));
    String jmsAddr = conf.getJmsAddress();
    Assert.assertEquals(jmsAddr, conf.resetJmsAddress());
    Assert.assertNotNull(conf.getJmsAddress());
    conf.setServiceName("{http://example.com/}AService");
    Assert.assertEquals(new QName("http://example.com/", "AService"), conf.getServiceName());
    conf.setEndpointName(new QName("http://example.com/", "AService"));
    Assert.assertEquals(new QName("http://example.com/", "AService"), conf.getEndpointName());
    conf.setEncodeURI(true);
    Assert.assertTrue(conf.isEncodeURI());
    conf.setEncodeURI("none");
    Assert.assertFalse(conf.isEncodeURI());
    conf.setConfiguration(null);
    Assert.assertNull(conf.getConfiguration());
}
Also used : JmsUriConfiguration(org.talend.esb.mep.requestcallback.beans.JmsUriConfiguration) HelloWorldImpl(org.talend.esb.mep.requestcallback.test.internal.HelloWorldImpl) JmsUriConfigurator(org.talend.esb.mep.requestcallback.beans.JmsUriConfigurator) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test)

Example 65 with EndpointImpl

use of org.apache.cxf.jaxws.EndpointImpl in project survey by markoniemi.

the class WebServiceConfig method pollServiceEndpoint.

@Bean
public Endpoint pollServiceEndpoint() {
    EndpointImpl endpoint = new EndpointImpl(bus, pollService);
    endpoint.setAddress("/soap/pollService");
    endpoint.publish("/soap/pollService");
    return endpoint;
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) Bean(org.springframework.context.annotation.Bean)

Aggregations

EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)66 QName (javax.xml.namespace.QName)14 Bean (org.springframework.context.annotation.Bean)10 Bus (org.apache.cxf.Bus)9 Test (org.junit.Test)9 BeforeClass (org.junit.BeforeClass)7 Endpoint (javax.xml.ws.Endpoint)5 URL (java.net.URL)4 HashMap (java.util.HashMap)4 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)4 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)4 Feature (org.apache.cxf.feature.Feature)4 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)4 SOAPBinding (javax.xml.ws.soap.SOAPBinding)3 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)3 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 JAXBException (javax.xml.bind.JAXBException)2 XMLStreamException (javax.xml.stream.XMLStreamException)2