Hi Sergey, Thanks a lot. It solved the issue. Now when i send an wrong input it behaves correctly. spitting something similar to,
JAXBException occurred : cvc-datatype-valid.1.2.1: '1pr' is not a valid value for 'integer'.. cvc-datatype-valid.1.2.1: '1pr' is not a valid value for 'integer' However I want to return json formatted error message to my clients. I tried engaging a exceptionMapper handler that handles JAXBException before and after the JSONProvider handler. But it fails to map the exception. During the databinding error scenario, the exception gets handled by org.apache.cxf.jaxrs.provider.AbstractJAXBProvider#handleJaxbException method it seems. your input is much appreciated.. thanks, --Pradeep On Thu, Apr 17, 2014 at 4:21 PM, Sergey Beryozkin <[email protected]>wrote: > And add xs:string type to name & value too > > Sergey > > On 17/04/14 11:49, Sergey Beryozkin wrote: > >> Hi >> On 17/04/14 11:04, Pradeep Fernando wrote: >> >>> Hi Devs, >>> >>> I'm using CXF Jax-rs libs. Did some google searching on the $subject and >>> since im using, >>> >>> org.apache.cxf.jaxrs.provider.json.JSONProvider, i made use of >>> >>> org.apache.cxf.jaxrs.utils.schemas.SchemaHandler to validate my input >>> against my schema. >>> >>> I get an input similar, to, >>> >>> { >>> "id": "AWSEC2AsiaPacificPartition1", >>> "provider": "ec2", >>> "property": [ >>> { >>> "name": "region", >>> "value": "ap-southeast-1" >>> } >>> ], >>> "partitionMin": "1", >>> "partitionMax": "3" >>> } >>> >>> I cant figure out how to model property array in xmlSchema without >>> using a >>> wrapping element. And it gives an error at the moment. >>> >>> The schema portion i use to validate the property array.. >>> >>> <xs:element name="property" minOccurs="1" maxOccurs="1"> >>> <xs:complexType> >>> <xs:sequence> >>> <xs:element name="property" minOccurs="0" >>> maxOccurs="unbounded"> >>> <xs:complexType> >>> <xs:sequence> >>> <xs:element name="name" >>> minOccurs="1" maxOccurs="1" nillable="false"/> >>> <xs:element name="value" >>> minOccurs="1" maxOccurs="1" nillable="false"/> >>> </xs:sequence> >>> </xs:complexType> >>> </xs:element> >>> </xs:sequence> >>> </xs:complexType> >>> </xs:element> >>> >>> >>> Am i doing the correct thing, May be im missing a trivial thing. Is it >>> possible at all. >>> >> >> >> <xs:element name="property" minOccurs="1" maxOccurs="unbounded"> >> <xs:complexType> >> <xs:sequence> >> <xs:element name="name" nillable="false"/> >> <xs:element name="value" nillable="false"/> >> </xs:sequence> >> </xs:complexType> >> </xs:element> >> >> Should probably do it >> >> Note, Bean Validation 1.1 is also supported in 3.0.0-milestone2 >> >> Cheers, Sergey >> >> >>> thanks in advance... >>> --Pradeep >>> >>> >> >> > > -- Pradeep Fernando. http://pradeepfernando.blogspot.com/
