So... I have an exception configured as.
@WebFault(name = "PlayerNotFound")
public class PlayerNotFoundFault extends Exception { }
There is also a faultInfo class.
@XmlRootElement(name = "ServiceException")
public class ServiceException { }
What I am finding is that when I call my service throught the XML
interface (http://<server>/services/xml/) I have configured ( using
spring config provided below ), the XMLFault element is namespaced to
http://cxf.apache.org/bindings/xformat, while the faultInfo element is
namespaced to my default namespace. For XML this is ok... no errors.
In the case of JSON/Jettison I get a namespace exception and nothing is
returned in the response. The restful_http_binding example has the same
issue.
Now, if I add http://cxf.apache.org/bindings/xformat to my outbound JSON
namespace then I do get the JSON response, but the content-type of the
response is 'text/xml' and I cant seem
To change that.
Any ideas? I would like either the XMLFault to fall under my namespace,
or to have the response content-type be configurable or honor the
factory bean config.
Thanks,
Derek.
-- Config ---
<?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" >
<bean id="JaxWsServiceFactoryBean-Player-XML"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="true" />
</bean>
<bean id="JaxWsServerFactoryBean-Player-XML"
class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
init-method="create">
<property name="bindingId"
value="http://apache.org/cxf/binding/http" />
<property name="address"
value="/xml/playermanager/" />
<property name="serviceClass"
value="com.fm.shinyfun.player.IPlayerManager" />
<property name="serviceBean">
<bean
class="com.fm.shinyfun.player.PlayerManagerImpl" />
</property>
<property name="serviceFactory">
<ref
bean="JaxWsServiceFactoryBean-Player-XML" />
</property>
</bean>
<bean id="JaxWsServiceFactoryBean-Player"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="true" />
</bean>
<bean id="JaxWsServerFactoryBean-Player"
class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
init-method="create">
<property name="bindingId"
value="http://apache.org/cxf/binding/http" />
<property name="address"
value="/json/playermanager" />
<property name="serviceClass"
value="com.fm.shinyfun.player.IPlayerManager" />
<property name="serviceBean">
<bean
class="com.fm.shinyfun.player.PlayerManagerImpl" />
</property>
<property name="serviceFactory">
<ref
bean="JaxWsServiceFactoryBean-Player" />
</property>
<property name="properties">
<map>
<entry
key="Content-Type" value="application/json" />
<entry
key="javax.xml.stream.XMLInputFactory">
<bean
class="org.codehaus.jettison.mapped.MappedXMLInputFactory">
<constructor-arg>
<map>
<entry key="http://player.shinyfun.fm.com/"
value="" />
</map>
</constructor-arg>
</bean>
</entry>
<entry
key="javax.xml.stream.XMLOutputFactory">
<bean
class="org.codehaus.jettison.mapped.MappedXMLOutputFactory">
<constructor-arg>
<map>
<entry key="http://player.shinyfun.fm.com/"
value="" />
<entry key="http://cxf.apache.org/bindings/xformat"
value="" />
</map>
</constructor-arg>
</bean>
</entry>
</map>
</property>
</bean>
</beans>
<!-- END SNIPPET: beans -->