📄 jmstopicexampletest.java
字号:
package org.codehaus.xfire.transport.jms.example;// START SNIPPET: jmsimport java.lang.reflect.Proxy;import org.codehaus.xfire.client.XFireProxy;import org.codehaus.xfire.client.XFireProxyFactory;import org.codehaus.xfire.service.Service;import org.codehaus.xfire.service.binding.ObjectServiceFactory;import org.codehaus.xfire.spring.AbstractXFireSpringTest;import org.codehaus.xfire.test.Echo;import org.codehaus.xfire.transport.jms.JMSTransport;import org.springframework.context.ApplicationContext;import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;public class JMSTopicExampleTest extends AbstractXFireSpringTest{ protected ApplicationContext createContext() { return new ClassPathXmlApplicationContext(new String[] { "/org/codehaus/xfire/transport/jms/example/jms-topic.xml", "/org/codehaus/xfire/spring/xfire.xml" }); } public void testClient() throws Exception { // Create a ServiceFactory to create the ServiceModel. // We need to add the JMSTransport to the list of bindings to create. ObjectServiceFactory sf = new ObjectServiceFactory(getTransportManager()); sf.addSoap11Transport(JMSTransport.BINDING_ID); // Create the service model Service serviceModel = sf.create(Echo.class); // Create a proxy for the service XFireProxyFactory factory = new XFireProxyFactory(getXFire()); Echo echo = (Echo) factory.create(serviceModel, "jms://GenericTopic?topic=Echo"); // Since JMS doesn't really have a concept of anonymous endpoints, we need // need to let xfire know what JMS endpoint we should use ((XFireProxy) Proxy.getInvocationHandler(echo)).getClient().setEndpointUri("jms://GenericTopic?topic=Echo"); // run the client! String resString = echo.echo("hello"); assertEquals("hello", resString); }}// END SNIPPET: jms
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -