I've been trying to add a JSON endpoint to my service by updating the
Spring configuration but with no success. The REST based version works
just fine, but the JSON version either: returns an empty-page for the
Mapped version or returns:
{"ns1:XMLFault":{"@xmlns":{"ns1":"http:\/\/cxf.apache.org\/bindings\/xformat"},"ns1:faultstring":{"@xmlns":{"ns1":"http:\/\/cxf.apache.org\/bindings\/xformat"},"$":"java.lang.NullPointerException"}}}
for the BadgerFish based version. In neither case is the Content-Type
header set. Any ideas where I'm going wrong?
Here are the relevant excerpts from my spring configuration.
<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-extension-http-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<jaxws:endpoint id="catalogRestWS"
implementor="#catalogService"
address="/xml/Catalog"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="true"/>
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>
<jaxws:endpoint id="catalogJsonWS"
implementor="#catalogService"
address="/json/Catalog"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="false"/>
<property name="properties">
<map>
<entry key="Content-Type" value="text/plain"/>
<entry>
<key><value>javax.xml.stream.XMLInputFactory</value></key>
<bean
class="org.codehaus.jettison.mapped.MappedXMLInputFactory">
<constructor-arg>
<map>
<entry
key="http://catalog.epv.oclc.org/" value="catalog"/>
<entry
key="http://impl.catalog.epv.oclc.org/" value="catalogimpl"/>
</map>
</constructor-arg>
</bean>
</entry>
<entry>
<key><value>javax.xml.stream.XMLOutputFactory</value></key>
<bean
class="org.codehaus.jettison.mapped.MappedXMLOutputFactory">
<constructor-arg>
<map>
<entry
key="http://catalog.epv.oclc.org/" value="catalog"/>
<entry
key="http://impl.catalog.epv.oclc.org/" value="catalogimpl"/>
</map>
</constructor-arg>
</bean>
</entry>
<!--
<entry>
<key><value>javax.xml.stream.XMLInputFactory</value></key>
<bean
class="org.codehaus.jettison.badgerfish.BadgerFishXMLInputFactory"/>
</entry>
<entry>
<key><value>javax.xml.stream.XMLOutputFactory</value></key>
<bean
class="org.codehaus.jettison.badgerfish.BadgerFishXMLOutputFactory"/>
</entry>
-->
</map>
</property>
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>