WebService-based remote call protocol, implemented based on Apache CXF frontend-simple
and transports-http
. Supported in versions 2.3.0
and above.
CXF is an Apache open-source RPC framework formed by the merger of Xfire and Celtix.
It can interoperate with native WebService services, meaning:
Serializable
interfacePublishing a service (internally/externally), regardless of client type or performance, it is recommended to use webservice. If the server has determined to use webservice, the client has no choice and must use webservice.
Starting from Dubbo 3, the Webservice protocol is no longer embedded in Dubbo and needs to be imported as a separate module.
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-webservice</artifactId>
<version>3.3.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" />
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 using servlet to dispatch requests:
The protocol port <dubbo:protocol port="8080" />
must match the port of the servlet container.
The protocol context path <dubbo:protocol contextpath="foo" />
must match the context path of the servlet application.