Hi ,
I just found your mistake, you set the XMLInputFactory twice in the
<jaxws:properties>
Willem
Robin Liu wrote:
Hi,
I want below configuration to support Json, how to modify? I try with
adding red, but it still return the xml format, can you help me?
In addtion, I tested with the sample[*
apache-cxf-2.1\samples\restful_http_binding*]
Thanks
Robin
<?xml version="1.0" encoding="UTF-8"?>
<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-http-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<bean id="xif" class="org.codehaus.jettison.mapped.MappedXMLInputFactory">
<constructor-arg>
<map>
<entry key="http://demo.restful.server">
<value>acme</value>
</entry>
</map>
</constructor-arg>
</bean>
<bean id="xof"
class="org.codehaus.jettison.mapped.MappedXMLOutputFactory">
<constructor-arg>
<map>
<entry key="http://demo.restful.server">
<value>acme</value>
</entry>
</map>
</constructor-arg>
</bean>
<jaxws:endpoint id="userService"
implementor="demo.restful.server.CustomerServiceImpl"
address="/customerService"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:properties>
<entry key="Content-Type" value="text/plain"/>
<entry key="XMLInputFactory">
<ref bean="xif"/>
</entry>
<entry key="XMLInputFactory">
<ref bean="xof"/>
</entry>
</jaxws:properties>
<jaxws:serviceFactory>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="false" />
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>
</beans>