Hi Adnan,

Did you pass an instance of ValidationEventHandler of the JaxbRepresentation
constructor?

I've also just added a JaxbRepresentation#setValidationEventHandler method
to allow post-construction setting of the property which is used by the
getObject() method to send validation events.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : [email protected] [mailto:[email protected]] 
Envoyé : mercredi 11 mars 2009 17:07
À : [email protected]
Objet : unable to get JAXB schema validation to work

Hello,

We're using Restlet version 1.2M1 and using the JaxbRepresentation class,
we're somehow unable to get the schema validation to work. I'm basically
just trying to validate when unmarshalling the request XML during a post
request.

The Object is successfully unmarshalled into it's corrsponding JAXB type but
the validation always passes even if I send a bad request with missing
elements, etc. here is a snippet of the code ..

public void acceptRepresentation (Representation entity) ...
  
JaxbRepresentation<DPSMessage> rep =
  new JaxbRepresentation<DPSMessage>(
      entity,"com.dps.jaxbmodel");
                                
   DPSMessage msg = rep.getObject();
   ....
}
 
Do I need to explicitly specify a schema or cast to a specific
representation ?

Any info, tips would be greatly appreciated.

Thanks in advance.
Adnan

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=13084
55

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1339551

Reply via email to