Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

CXF supports a much wider range of options for deploying your service over HTTP. XFire created a static mapping between the HTTP URL and the service name - i.e. a service named "HelloService" was accessible at http://localhost/services/HelloServiceImage Removed. CXF on the other hand allows you to control the URL which your service is published on. This address is provided to CXF either through the setAddress() call on the ServerFactoryBeans or via your XML configuration.

...

Section
Column
width50%

XFire services.xml example:

Code Block
xml
xml
<beans xmlns="http://xfire.codehaus.org/config/1.0">

<service xmlns:t="urn:my:namespace">
	<name>testservice</name>
	<serviceClass>org.example.TestService
	</serviceClass>
	<implementationClass>org.codehaus.xfire.spring.TestServiceImpl</implementationClass>
	<namespace>urn:my:namespace</namespace>
	<serviceFactory>org.codehaus.xfire.jaxws.JAXWSServiceFactory</serviceFactory>

	<properties>
		<property key="myKey">value</property>
        </properties>

	<inHandlers>
		<handler handlerClass="org.codehaus.xfire.spring.TestHandler"/>
	</inHandlers>
</service>

</beans>
Column

CXF example:

Code Block
xml
xml
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jaxws="http://cxf.apache.org/jaxws"
      xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws 
http://cxf.apache.org/schemas/jaxws.xsd">
 <import resource="classpath:META-INF/cxf/cxf.xml" />
 <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
 <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

  <jaxws:endpoint address="http://localhost/testService" 
    serviceName="t:testService" 
    xmlns:t="urn:my:namespace">
    <jaxws:implementor>
      <bean class="org.example.TestServiceImpl"/>
    </jaxws:implementor>
    <jaxws:properties>
      <entry key="foo" value="bar"/>
    </jaxws:properties>
    <jaxws:inInterceptors>
      <bean class="org.example.ExampleInterceptor"/>
    </jaxws:inInterceptors>
  </jaxws:endpoint>

</beans>  

There are a few important things to note here on the differences:

...

Code Block
xml
xml
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:simple="http://cxf.apache.org/simple"
      xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/simple
http://cxf.apache.org/schemas/simple.xsd">

  <simple:server address="http://localhost/testService" 
    serviceClass="org.example.TestService">
    <simple:serviceBean>
      <bean class="org.example.TestServiceImpl"/>
    </simple:serviceBean>
    <simple:properties>
      <entry key="foo" value="bar"/>
    </jaxws:properties>
    <simple:inInterceptors>
      <bean class="org.example.ExampleInterceptor"/>
    </simple:inInterceptors>
  </simple:endpoint>

</beans>