All Products
Document Center

Using XML

Last Updated: Aug 21, 2020

This topic describes how to publish and reference services in the XML mode. The following are the tabs in the XML configuration and their meanings.

  • sofa:service indicates publishing a service.
  • sofa:reference indicates referencing a service.
  • sofa:binding indicates the protocol for service publication or reference.

Code example of publishing a service:

  1. <bean id="personServiceImpl" class=""/>
  2. <sofa:service ref="personServiceImpl" interface="">
  3. <sofa:binding.bolt/>
  4. </sofa:service>

You can publish a service by using multiple protocols.

  1. <sofa:service ref="personServiceImpl" interface="">
  2. <sofa:binding.bolt/>
  3. <>
  4. <sofa:binding.dubbo/>
  5. </sofa:service>

Code example of referencing a service:

  1. <sofa:reference id="personReferenceBolt" interface="">
  2. <sofa:binding.bolt/>
  3. </sofa:reference>

You can also reference a service by using other protocols.

  1. <sofa:reference id="personReferenceRest" interface="">
  2. <>
  3. </sofa:reference>