cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <...@envoisolutions.com>
Subject Re: Problem with JSON/Jettison and WebFault/Exceptions
Date Wed, 11 Jul 2007 22:14:42 GMT
Hi Derek,

It seems this is a bug with the HTTP Binding. Can you file a JIRA issue for
this? I'll take a look and get a fix committed soon. In essence the problem
is we aren't adding an interceptor which sets the fault chain.

Cheers,
- Dan

On 7/11/07, Derek Shaw <dshaw@funmobility.com> wrote:
>
> 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 -->
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message