基於 WebService 的遠程調用協議,基於 Apache CXF(Apache 開源的一個 RPC 框架)的 frontend-simple 和 transports-http 實現。web
能夠和原生 WebService 服務互操做,即:apache
依賴app
<dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-simple</artifactId> <version>2.6.1</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>2.6.1</version> </dependency>
特性框架
約束frontend
配置ide
配置協議:url
<dubbo:protocol name="webservice" port="8080" server="jetty" />
配置默認協議:spa
<dubbo:provider protocol="webservice" />
配置服務協議:code
<dubbo:service protocol="webservice" />
多端口:server
<dubbo:protocol id="webservice1" name="webservice" port="8080" /> <dubbo:protocol id="webservice2" name="webservice" port="8081" />
直連:
<dubbo:reference id="helloService" interface="HelloWorld" url="webservice://10.20.153.10:8080/com.foo.HelloWorld" />
WSDL:
http://10.20.153.10:8080/com.foo.HelloWorld?wsdl
Jetty Server (默認):
<dubbo:protocol ... server="jetty" />
Servlet Bridge Server (推薦):
<dubbo:protocol ... server="servlet" />
配置 DispatcherServlet:
<servlet> <servlet-name>dubbo</servlet-name> <servlet-class>com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dubbo</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
注意,若是使用 servlet 派發請求: