Search in sources :

Example 1 with JMSConfigFeature

use of org.apache.cxf.transport.jms.JMSConfigFeature in project cxf by apache.

the class JMSClientServerTest method testReplyAndReplyToDestinations.

@Test(expected = SOAPFaultException.class)
public void testReplyAndReplyToDestinations() throws Exception {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setWsdlLocation("classpath:/wsdl/jms_test.wsdl");
    factory.setServiceName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService"));
    factory.setEndpointName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort"));
    factory.setAddress("jms://");
    JMSConfigFeature feature = new JMSConfigFeature();
    JMSConfiguration config = new JMSConfiguration();
    config.setConnectionFactory(new ActiveMQConnectionFactory(broker.getBrokerURL()));
    config.setRequestURI("test.jmstransport.text");
    config.setTargetDestination("test.jmstransport.text");
    // replyDestination and replyToDestination intentionally differ in this test scenario
    // replyDestination = Destination name to listen on for reply messages
    config.setReplyDestination("test.jmstransport.text.reply");
    // replyToDestination = Destination name to send out as replyTo address in the message
    config.setReplyToDestination("test.jmstransport.text.replyTo");
    config.setReceiveTimeout(1000L);
    feature.setJmsConfig(config);
    factory.getFeatures().add(feature);
    HelloWorldPortType greeter = factory.create(HelloWorldPortType.class);
    try {
        greeter.greetMe("FooBar");
    // Timeout exception should be thrown
    } finally {
        ((java.io.Closeable) greeter).close();
    }
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) JMSConfiguration(org.apache.cxf.transport.jms.JMSConfiguration) JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature) QName(javax.xml.namespace.QName) Closeable(java.io.Closeable) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) HelloWorldPortType(org.apache.cxf.hello_world_jms.HelloWorldPortType) Test(org.junit.Test)

Aggregations

Closeable (java.io.Closeable)1 QName (javax.xml.namespace.QName)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 HelloWorldPortType (org.apache.cxf.hello_world_jms.HelloWorldPortType)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1 JMSConfigFeature (org.apache.cxf.transport.jms.JMSConfigFeature)1 JMSConfiguration (org.apache.cxf.transport.jms.JMSConfiguration)1 Test (org.junit.Test)1