cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reed, Nate" <nr...@hoovers.com>
Subject namespaces in XMLBeansJSONProvider (CXF 2.2.8)
Date Mon, 14 Jun 2010 18:10:55 GMT
Hi,

 

I'm using CXF 2.2.8 and I found a problem when trying to write out
XMLBeans using Jettison.   I get the following error:

 

java.lang.IllegalStateException: Invalid JSON namespace:
http://www.w3.org/2001/XMLSchema-instance

13:06:50,029 ERROR [STDERR]   at
org.codehaus.jettison.mapped.MappedNamespaceConvention.getJSONNamespace(
MappedNamespaceConvention.java:248)

13:06:50,029 ERROR [STDERR]   at
org.codehaus.jettison.mapped.MappedNamespaceConvention.createAttributeKe
y(MappedNamespaceConvention.java:233)

13:06:50,029 ERROR [STDERR]   at
org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeAttribute(Mapped
XMLStreamWriter.java:216)

13:06:50,029 ERROR [STDERR]   at
org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeAttribute(Mapped
XMLStreamWriter.java:225)

13:06:50,029 ERROR [STDERR]   at
org.apache.cxf.jaxrs.provider.XMLBeanStreamSerializer.serialize(XMLBeanS
treamSerializer.java:96)

13:06:50,029 ERROR [STDERR]   at
org.apache.cxf.jaxrs.provider.XMLBeansJSONProvider.writeTo(XMLBeansJSONP
rovider.java:98)

...

 

It looks related to this issue:

https://issues.apache.org/jira/browse/CXF-1671

 

Did this patch make it into 2.2.8?  From looking at XMLBeansJSONProvider
it doesn't appear that this code handles namespaces:

 

    public void writeTo(XmlObject obj, Class<?> cls, Type genericType,
Annotation[] annotations,  

                        MediaType m, MultivaluedMap<String, Object>
headers, OutputStream os) {

 

        try {

 

            // Set up the JSON StAX implementation

            Map<String, String> nstojns = new HashMap<String, String>();

            XMLOutputFactory factory = new
MappedXMLOutputFactory(nstojns); 

 

"nstojns" is an empty map which gets passed to MappedXMLOutputFactory.
Presumably, this is a map of namespaces that Jettison needs to know
about.   Is there an easy fix for my project or do I have to
extend/patch XMLBeansJSONProvider?

 

Nate

 

 


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