From Resin 3.0

Jump to: navigation, search
40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit for the most up-to-date documentation.

CXF and Resin

Resin features easy creation and deployment of CXF web services and clients, avoiding the need for complicated configuration.

(The following has been tested with Resin 3.1.5 and CXF 2.0.3)

  1. Download Resin from
  2. Unzip Resin into /usr/local/share/resin
  3. Create the CXF webapp directory structure:
    mkdir -p /usr/local/share/resin/webapps/cxf/WEB-INF/lib/
    mkdir -p /usr/local/share/resin/webapps/cxf/WEB-INF/classes/demo/
  4. Download CXF from
  5. Unzip CXF
  6. Copy all the jars included the CXF lib/ directory to
  7. Create the configuration file /usr/local/share/resin/webapps/cxf/WEB-INF/resin-web.xml
    <web-app xmlns="">
     <servlet-mapping url-pattern='/StrLenDemo/*' servlet-class='demo.StrLenDemo'/>
     <servlet-mapping url-pattern='/StrLen/*' servlet-class='demo.StrLenImpl'>
        <protocol uri="cxf:"/>
      <remote-client interface="demo.StrLen" name="StrLenClient">
  8. Create the interface file /usr/local/share/resin/webapps/cxf/WEB-INF/classes/demo/
    package demo;
    import javax.jws.WebMethod;
    import javax.jws.WebService;
    public interface StrLen {
      public int strlen(String x);
  9. Create the implementation file /usr/local/share/resin/webapps/cxf/WEB-INF/classes/demo/
    package demo;
    import javax.jws.WebService;
    public class StrLenImpl
      public int strlen(String x)
        return x.length();
  10. Create a Servlet to access the service /usr/local/share/resin/webapps/cxf/WEB-INF/classes/demo/
    package demo;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.webbeans.In;
    public class StrLenDemo extends HttpServlet
      @In StrLen strlenClient;
      public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException
        Writer out = resp.getWriter();
        out.write("strlen(\"hello, world\") = " + 
                  strlenClient.strlen("hello, world"));
  11. Start Resin with java -jar /usr/local/share/resin/lib/resin.jar
  12. Look at http://localhost:8080/cxf/StrLenDemo
    It should show
    strlen("hello, world") = 12
Personal tools