Xiaowhyyan commented on issue #2590: dubbo发布http服务后 http客户端访问问题 URL: https://github.com/apache/incubator-dubbo/issues/2590#issuecomment-425916664 你好 很高兴你能回复 你这边给的答案 1、https://github.com/apache/incubator-dubbo/tree/master/dubbo-demo 这个是讲解如何使用dubbo 发布dubbo接口 如何写provider consumer客户端 这个我是清楚的 2、http://dubbo.apache.org/zh-cn/docs/user/quick-start.html 这个文档里 有说明如何让dubbo发布http服务 我这边已经发布出来了 <dubbo:protocol name="http" port="20991"/> 我再阐述下我的问题哈 我的问题是: 我使用dubbo框架发布http协议接口(注意不是dubbo协议) http接口发布以后,客户端如何调用已经发布的http协议接口 官网上没有看到范例,所以我就去找dubbo的这个测试代码 路径为 incubator-dubbo/dubbo-rpc/dubbo-rpc-http/src/test/java/org/apache/dubbo/rpc/protocol/http/HttpProtocolTest.java 而这块测试代码也是采用的dubbo自身的api 类来发送http请求 如: @Test public void testHttpProtocol() { HttpServiceImpl server = new HttpServiceImpl(); Assert.assertFalse(server.isCalled()); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); URL url = URL.valueOf("http://127.0.0.1:5342/" + HttpService.class.getName() + "?version=1.0.0"); Exporter<HttpService> exporter = protocol.export(proxyFactory.getInvoker(server, HttpService.class, url)); Invoker<HttpService> invoker = protocol.refer(HttpService.class, url); HttpService client = proxyFactory.getProxy(invoker); String result = client.sayHello("haha"); Assert.assertTrue(server.isCalled()); Assert.assertEquals("Hello, haha", result); invoker.destroy(); exporter.unexport(); } 但是我想用 比如postman往dubbo http接口上发请求 ,以com.why.jiekou.UserInter接口 String sayHello(String name)方法为例 请求的path路径是什么样的? 报文格式是什么样的? 麻烦啦
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
