Unity Logo

services.xml Reference

The basic structure of a configuration is like so:

Service Options

Here are options common to all bindings. The sections following outline options for specific bindings.

The name element is required. This will be the name of the service as exposed to the world. You will also use this name to access the Service class from the ServiceRegistry.

The namespace element is optional, it specifies the target namespace for the service.

The style element is optional and defaults to "wrapped". Services can be of style wrapped, message, document, or rpc. Keep in mind that "document and "wrapped" both specify a document-style service but with different parameter styles, bare (unwrapped) and wrapped, respectively. The "message" option is also document style.

The "use" element is optional and defaults to "literal". This determines the encoding type and can be either encoded or literal. Only literal services are supported currently.

The class name of the object you wish to make into a service. Required.

The class name of the implementation which you wish to use when the service is invoked. Optional.

The ServiceFactory controls how the Service is built and configured. Optional.

To use the Java 5 JSR 181 Service factory

To use the Commons-Attributes JSR 181 Service factory

If you are using XMLBeans, you will want to specify "<serviceFactory>org.codehaus.xfire.xmlbeans.XmlBeansServiceFactory</serviceFactory>".

The path to the WSDL file for your service. Optional.

The scope element is optional. Specify "application" to have your service object persist indefinitely, "session" to have one service object per session, and "request" to create a new service object for every request. The default is "application".

The invoker element is optional. It can be used to set a non-default Invoker for a service. Available since XFire 1.1-beta1

The executor element is optional. It can be used to set a non-default Executor (i.e. scheduler) for a service. Available since XFire 1.1-beta1

To configure a #bean using a constructor parameter you can use the following syntax.


You may want to add request, response or fault handlers to your service. To do this use the <requestHandlers>, <responseHandlers> or <faultHandlers> sections:


You may want to configure bindings for your service to allow it to talk on other transports. By default, the ObjectServiceFactory (and AnnotationServiceFactory) create a SOAP 1.1 HTTP binding. <createDefaultBindings> will suppress the creation of the default bindings if set to "false", and is "true" by default.

On a binding you specify a transport. This is the ID of the transport you want to reference. For instance:


Transport ID











On bindings you can also specify endpoints which you listen on. XFire will then look at the incoming message's URI then map the service to that request if it matches.

So lets combine everything and create a JMS transport for SOAP 1.1:

Using the endpoint syntax allows us to override the default URL resolution. However only certain transports like HTTP have their own service resolution method, whereby services names are extracted in a URL Transports like JMS however do not have that capability.

Here is a SOAP 1.2 endpoint for http which just uses the default service resolution:

Service Properties








Specifies whether or not the WSDLBuilder should generate imports for all the schemas in your WSDL. Necessary with some tools.




Specifies whether or not the WSDLBuilder should remove the schemaLocations from schemas which are added to the WSDLBuilder.




Specifies whether or not the WSDLBuilder should remove all the imports from the schemas. This turns both the import generation and cleaning off.

Using spring beans

 Because all XFire configuration tags uses "http://xfire.codehaus.org/config/1.0" namespace, to use "plain" spring tag you must set its namespace to empty value  xmlns="". For example :

 <inHandlers>  <!-Xfire configuration tag ->

      <handler handlerClass="org.codehaus.xfire.util.dom.DOMInHandler" /> <!- Xfire configuration tag ->

      <bean class="org.codehaus.xfire.security.wss4j.WSS4JInHandler" xmlns=""> <!- spring tag ->





Spring 2.x support

 Because of Spring 2.x new feature, services.xml default namespace must not be declared on the root element of configuration ( beans ) and need to be moved to <service> tag level.

© 2003-2008 Codehaus