WebService-based remote invocation protocol, implemented based on frontend-simple
and transports-http
of Apache CXF. 2.3.0
and above are supported.
CXF is an open source RPC framework of Apache, which is merged from Xfire and Celtix.
It can interoperate with native WebService services, namely:
Serializable
interfaceTo publish a service (internal/external), regardless of client type or performance, it is recommended to use webservice. The server has determined to use webservice, the client cannot choose, and must use webservice.
Starting from Dubbo 3, the Webservice protocol is no longer embedded in Dubbo, and an independent module needs to be introduced separately.
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-webservice</artifactId>
<version>1.0.0</version>
</dependency>
<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>
<dubbo:protocol name="webservice" port="8080" server="jetty" />
<dubbo:provider protocol="webservice" />
<dubbo:service protocol="webservice" />
<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
<dubbo:protocol ... server="jetty" />
<dubbo:protocol ... server="servlet" />
<servlet>
<servlet-name>dubbo</servlet-name>
<servlet-class>org.apache.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>
If a servlet is used to dispatch the request
- The protocol port
<dubbo:protocol port="8080" />
must be the same as the port of the servlet container.- The context path of the protocol
<dubbo:protocol contextpath="foo" />
must be the same as the context path of the servlet application.