XFire

Home
Bug/Issue Reporting
Download
FAQ
Get Involved
License
News
Stack Comparison
Support
User's Guide
XFire Team

M5

Javadocs
Reports

M6-SNAPSHOT

Javadocs
Reports

Developers

Developer Space
CVS
Building
Architecture
Interesting Projects
Release Process

You may want to use an xml configuration to configure XFire and your services instead of using the API. In such a case, XFire provides support for a "services.xml" file.

Container Support

XFire may already have native support for a container that you are using. If so, you may want to skip ahead to Container Support to achieve better integration with your existing platform. If you dont' know what a container is, containers manage components and configurations for you. Good examples are Spring, Plexus, Loom, PicoContainer, Geronimo, etc.

To use a services.xml to configure your services takes 2 steps:

  1. Write the services.xml file
  2. Update your web.xml file

Write the services.xml file

A simple services.xml looks like so:

<xfire>
  <services>
    <service>
      <name>MyService</name>
      <serviceClass>my.service.Class</serviceClass>

      .... other options ...
    <service>
    <service>
      <serviceClass>another.service.Class</serviceClass>
    </service>
  </services>
</xfire>

This file should be placed in your classpath at "META-INF/xfire/services.xml". See the services.xml Reference guide for more information.

Update your web.xml file

You will need to switch from using XFireServlet to the XFireConfigurableServlet which looks for services.xml files on the classpath. Modify your web.xml file to look like so:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    
<web-app>

  <servlet>
    <servlet-name>XFire</servlet-name>
    <display-name>XFire Servlet</display-name>
    <servlet-class>
        org.codehaus.xfire.transport.http.XFireConfigurableServlet
    </servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>services.xml</param-value>
    </init-param>
  </servlet>

  <servlet-mapping>
    <servlet-name>XFire</servlet-name>
    <url-pattern>/servlet/XFireServlet/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>XFire</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  
</web-app>