...
CXF uses the JAXB reference implementation. To learn more about annotating your classes or how to generate beans from a schema, please read the JAXB user's guide.
JAXB versus JAX-WS (or other front-ends)
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<jaxws:server id="bookServer"
serviceClass="org.myorg.mytypes.AnonymousComplexTypeImpl"
address="http://localhost:8080/act"
bus="cxf">
<jaxws:invoker>
<bean class="org.apache.cxf.service.invoker.BeanInvoker">
<constructor-arg>
<bean class="org.myorg.mytypes.AnonymousComplexTypeImpl"/>
</constructor-arg>
</bean>
</jaxws:invoker>
<jaxws:dataBinding>
<bean class="org.apache.cxf.jaxb.JAXBDataBinding">
<property name="contextProperties">
<map>
<entry>
<key><value>com.sun.xml.bind.defaultNamespaceRemap</value></key>
<value>uri:ultima:thule</value>
</entry>
</map>
</property>
</bean>
</jaxws:dataBinding>
</jaxws:server>
|
...
The JAXB reference implementation allows the application to provide an object that in turn maps namespace URI's to prefixes. You can create such an object and supply it via the marshaller properties. However, CXF provides an easier process. The namespaceMap property of the JAXBDataBinding accepts a Map<String, String>. Think of it as a map from namespace URI to namespace prefix. If you load up this map, CXF will set up the necessary marshaller property for you.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<jaxws:server id="bookServer"
serviceClass="org.myorg.mytypes.AnonymousComplexTypeImpl"
address="http://localhost:8080/act"
bus="cxf">
<jaxws:invoker>
<bean class="org.apache.cxf.service.invoker.BeanInvoker">
<constructor-arg>
<bean class="org.myorg.mytypes.AnonymousComplexTypeImpl"/>
</constructor-arg>
</bean>
</jaxws:invoker>
<jaxws:dataBinding>
<bean class="org.apache.cxf.jaxb.JAXBDataBinding">
<property name="namespaceMap">
<map>
<entry>
<key><value>http://cxf.apache.org/anonymous_complex_type/</value></key>
<value>BeepBeep</value>
</entry>
</map>
</property>
</bean>
</jaxws:dataBinding>
</jaxws:server>
|
...