I had the same problem than you and ignoreNamespaces=true didn't work
for me ( I'm using Apache CXF 2.7.3 and Jettison 1.3.4 )
I don't know why.
If you try it and it works for you, please notify to me.
To solved that, I had to map my namespace to empty string ( "") **
only for JSON messages**, not for XML messages:
<util:map id="jsonNamespaceMap" map-class="java.util.Hashtable">
<entry key="http://domain.com/ws/type" value=""/>
</util:map>
<bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="namespaceMap" ref="jsonNamespaceMap"/>
</bean>
Regards
2013/12/7 Alex O'Ree <[email protected]>:
> Hi I have a JAXB annotated (wsimport) jaxws service that i'm writing
> an adapter for using jaxrs and jettison with 2.7.5.
>
> When service the rest endpoint with XML using the jaxws objects, it
> works just fine. However when serving JSON encoding data in response,
> I get this.
>
> Caused by: java.lang.IllegalStateException: Invalid JSON namespace:
> urn:uddi-org:api_v3
> at
> org.codehaus.jettison.mapped.MappedNamespaceConvention.getJSONNamespace(MappedNamespaceConvention.java:252)
> at
> org.codehaus.jettison.mapped.MappedNamespaceConvention.createKey(MappedNamespaceConvention.java:260)
> at
> org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeStartElement(MappedXMLStreamWriter.java:220)
> at
> com.sun.xml.bind.v2.runtime.output.XMLStreamWriterOutput.beginStartTag(XMLStreamWriterOutput.java:118)
>
> Beans.xml config file
>
> <jaxrs:server id="inquiryRestService" address="/inquiryRest">
> <jaxrs:serviceBeans>
> <ref bean="inquiryRest" />
> </jaxrs:serviceBeans>
> </jaxrs:server>
> <bean id="inquiryRest"
> class="org.apache.juddi.api.impl.rest.UDDIInquiryJAXRS" >
> </bean>
> <bean id="jaxbProvider"
> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
> <property name="ignoreNamespaces" value="true"/>
> </bean>
>
>
> this part works
> @GET
> @Path("/XML/businessDetail/{id}")
> @Produces("application/xml")
> @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details
> of a business entity in XML")
> public org.uddi.api_v3.BusinessEntity
> getBusinessDetailXML(@PathParam("id") String id) throws
> WebApplicationException {
> return getBusinessDetail(id);
> }
>
>
> this part does not
> @GET
> @Path("/JSON/businessDetail/{id}")
> @Produces("application/json")
> @org.apache.cxf.jaxrs.model.wadl.Description("Returns the details
> of a business entity in JSON")
> public org.uddi.api_v3.BusinessEntity
> getBusinessDetailJSON(@PathParam("id") String id) throws
> WebApplicationException {
> return getBusinessDetail(id);
> }
>
> The complete code is over here:
> http://svn.apache.org/repos/asf/juddi/trunk/juddi-rest-cxf/
>
> From googling, I've seen that adding the ignoreNamespaces=true should
> fix this, but I'm not sure if I have it in the write place. The docs
> don't have a clear example of this