I am trying to send a POST request with a JSON or XML body to a service. This 
request body conforms to an xsd I have defined in the schemaHandler property, 
which i have registered with the JSONProvider and the JAXBProvider.
        <bean id="bgacRSJsonProvider" 
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">        <property 
name="dropRootElement" value="false"/>        <property name="supportUnwrapped" 
value="true"/>        <property name="ignoreNamespaces" value="true"/>        
<property name="schemaHandler" ref="schemaHolder"/>        <property 
name="validateOutput" value="true"/>
    <bean id="schemaHolder" 
class="org.apache.cxf.jaxrs.utils.schemas.SchemaHandler">        <property 
name="schemas" ref="schemas"/>    </bean>
    <util:list id="schemas">        
<value>classpath:webapi/xsd/schema.xsd</value>    </util:list>
With an xml body the service will return a valid response if the request is 
valid.....if the request breaks the schema rules it will return an error as 
expected. However if the request body is JSON (where no namespace is specified) 
the response is an error similar to that below:
[org.xml.sax.SAXParseException; columnNumber: 0; cvc-elt.1: Cannot find the 
declaration of element 'xxxRequest'.]
The xxxRequest refers to the Class of the object the resource is expecting.
Could you explain why the XML works but the JSON doesn't.
ThanksAndy                                        

Reply via email to