Skip to main content Skip to complementary content

Runtime

You need to configure the runtime to tell it to use XMLBeans for the databinding instead of JAXB.

Spring config

For the server side, your spring configuration would contain something like:

<jaxws:server serviceClass="demo.hw.server.HelloWorld" 
            address="/hello_world">
            <jaxws:dataBinding>
            <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
            </jaxws:dataBinding>
            </jaxws:server>

or

<jaxws:endpoint
            id="helloWorld"
            implementor="demo.spring.HelloWorldImpl"
            address="http://localhost/HelloWorld">
            <jaxws:dataBinding>
            <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
            </jaxws:dataBinding>
            </jaxws:endpoint>

The client side is very similar:

<jaxws:client id="helloClient"
            serviceClass="demo.spring.HelloWorld"
            address="http://localhost:9002/HelloWorld">
            <jaxws:dataBinding>
            <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding" />
            </jaxws:dataBinding>
            <jaxws:client>

FactoryBeans

If using programmatic factory beans instead of spring configuration, the databinding can be set on the ClientProxyFactoryBean (and subclasses) and the ServerFactoryBean (and subclasses) via:

factory.getServiceFactory().setDataBinding(
            new org.apache.cxf.xmlbeans.XmlBeansDataBinding());

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!