使用hessian实现web服务接口(二)

版权声明:未经允许,不得转载 https://blog.csdn.net/dhj199181/article/details/84551493

客户端调用Hessian发布的web接口

public class HessianServiceTest {
	
	private final static String SERVICE_URL = "http://localhost:8080/web-socket/hs/service";

	public static void main(String[] args) {
		try {
			HessianProxyFactory proxyFactory = new HessianProxyFactory();
			HessianService hessianService = (HessianService) proxyFactory.create(HessianService.class, SERVICE_URL);
			String result  = hessianService.sayHello("Jim");
			System.out.println(result);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	}
}

调用结果:

猜你喜欢

转载自blog.csdn.net/dhj199181/article/details/84551493