Migrating applications from Celtix to CXF is reasonably straightforward; both follow the JAX-WS mapping so the bulk of application code will no require any modification.

Here are some things to look out for:

  • There are some obvious changes of package names from org.objectweb.celtix.* to org.apache.cxf.*. If you have used any Celtix-specific non-JAX-WS APIs in your application (for example, using the Bus), then you must change imported package names.
  • There is no Bus.init() or Bus.getCurrent() method. In CXF, you can create a bus using concrete implementations of the BusFactory.createBus() method, and then make your new bus the default bus as shown below.
SpringBusFactory bf = new SpringBusFactory();
    Bus bus = bf.createBus("ws_rm.xml");

Later, to get the bus, you can call:

Bus bus = bf.getDefaultBus();
  • On your classpath, change celtix.jar to cxf-manifest.jar; this jar contains manifest entries to pick up all other required jars in the CXF runtime.
  • If you call getPort() on the client side, then you must specify the target namespace of the WSDL contract as the namespace of the port name, like this:
HelloWorld helloWorld = helloWorldService.getPort(
                        new QName("http://www.my/wsdl/target/namespace", "SOAPOverHTTPEndpoint"),
                                    HelloWorld.class );

In Celtix you could leave the namespace of the port name as an empty string "". However, if you do that in CXF, the call to getPort() will fail. This latter behavior is more in keeping with the JAX-WS specification (see Section 4.2.3 of the JAX-WS Specification).

  • No labels