Skip to main content

Configuration of Clients

CXF JAX-RS clients can be configured programmatically or from Spring.

Configuring the clients from Spring often implies that the client instances are injected into JAX-RS or JAX-WS endpoints so that the incoming request can be further delegated to the RESTful service. Both proxies and WebClient instances can be configured from Spring:

<jaxrs:client id="restClient"
   address="http://localhost:9000/test/services/rest"
   serviceClass="server.BookStoreJaxrsJaxws">
   <jaxrs:headers>
      <entry key="Accept" value="text/xml"/>
   </jaxrs:headers>
</jaxrs:client>  
          
<bean id="webClient" class="org.apache.cxf.jaxrs.client.WebClient" 
   factory-method="create"> 
   <constructor-arg type="java.lang.String" 
   value="http://localhost:9000/books/" /> 
</bean>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!