Ritesh- Which schema are you validating with? Also which schemaLocation are you pointing to ?
M-- ----- Original Message ----- From: "robert lazarski" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, October 09, 2007 8:41 AM Subject: Re: Question : Turning Off XSD Validation in Axis 2 > Look at the xmlbeans api for the validate() method. For example: > > XmlError error = > validateSolicitacaoProcedimentoDocument(solicitacaoProcedimentoDocument); > if (error != null) { > throw new Exception("Objeto > solicitacaoDemonstrativoRetornoDocument " > + "is invalid: " > + error); > } > > public static XmlError validateSolicitacaoProcedimentoDocument ( > br.gov.ans.www.tiss.ws.tipos.tisssolicitacaoprocedimento.SolicitacaoProcedim entoDocument > solicitacaoProcedimentoDocument) { > // Create an XmlOptions instance and set the error listener. > XmlOptions validateOptions = new XmlOptions(); > List<XmlError> errorList = new ArrayList<XmlError>(); > validateOptions.setErrorListener(errorList); > if (!solicitacaoProcedimentoDocument.validate(validateOptions)) { > for (int i = 0; i < errorList.size(); i++) { > XmlError error = (XmlError)errorList.get(i); > System.out.println("Object solicitacaoProcedimentoDocument " > + "is invalid, " > + "The following field is empty: "); > System.out.println("\n"); > System.out.println("Error Message: " + > error.getMessage() + "\n"); > System.out.println("Location of invalid XML: " > + error.getCursorLocation().xmlText() + "\n"); > } > return errorList.get(0); > } > System.out.println("solicitacaoProcedimentoDocument seems to be > valid\n"); > return null; > } > > Not exactly pretty, but xmlbeans has the unique advantage that it has > arguably 100% xml schema compliance - the only databinding in axis2 > that does. It also is arguably the most stable api. In alot of cases, > in axis2 its the only choice. > > The disadvantage is slightly slower performance, though still very > good compared to axis1, an awkward api, etc. > > HTH, > Robert > > On 10/9/07, Ritesh Tarway <[EMAIL PROTECTED]> wrote: > > I tested it and actually found that none of bindings enforce full schema > > validation. So the issue is 2-fold, > > 1. There should be a schema validation which can be turned on during > > testing. > > 2. Schema validation can be turned off during production without any code > > change in web service, preferably with same set of modules as used in test > > machines. > > > > As far as manual validation is concerned , I can write custom code inside > > the service to validate it against any schema. but that is not what I want. > > > > I am going through your module for jibx and probably would use that. Thanks > > for pointers. > > > > > > On 10/9/07, Dennis Sosnoski <[EMAIL PROTECTED]> wrote: > > > Hi Ritesh, > > > > > > I'm surprised to see this, since as I said in my prior email XMLBeans > > > does very little in the way of schema validation by default. You can > > > manually validate the data, but unless the generated code includes the > > > validation I don't know why you'd be running into problems. > > > > > > What kind of error are you getting? > > > > > > - Dennis > > > > > > -- > > > Dennis M. Sosnoski > > > SOA and Web Services in Java > > > Axis2 Training and Consulting > > > http://www.sosnoski.com - http://www.sosnoski.co.nz > > > Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 > > > > > > > > > > > > Ritesh Tarway wrote: > > > > Unluckily my service has been generated using wsdl2java tool with > > xmlbeans > > > > binding....so xsd validation will be turned on..... > > > > alright.....i think there is some 3rd party custom module to turn off > > > > validation if i use jibx binding....is there any such thing for xml > > beans?? > > > > > > > > > > > > On 10/8/07, Thilina Gunarathne <[EMAIL PROTECTED]> wrote: > > > > > > > >> Hi, > > > >> AFAIK Axis2 does not do any XSD validation unless you use data binding. > > > >> XML to java object conversion that happens when you have used data > > > >> binding, expects the message to conform to the schema. > > > >> > > > >> IIRC XMLBeans enforces this heavily, while ADB use it only when > > > >> absolutely necessary. There are some switches like "backword > > > >> compatibility mode" which you can use when code generating(data > > > >> binding) to reduce the enforcement of some schema constructs. > > > >> > > > >> In other words, you cannot turn off schema validation completely if > > > >> you are using data binding. > > > >> > > > >> thanks, > > > >> Thilina > > > >> > > > >> On 10/8/07, Ritesh Tarway <[EMAIL PROTECTED]> wrote: > > > >> > > > >>> Is there a way to turn off XSD validation in production env? I would > > > >>> > > > >> want it > > > >> > > > >>> to be a flag in axis configuration to turn off validation globally for > > > >>> > > > >> all > > > >> > > > >>> deployed services? > > > >>> > > > >>> platform information : Axis2/Java Version 1.3 , deployed on tomcat or > > > >>> websphere, using sun's JVM ( jdk 1.5.0) > > > >>> -- > > > >>> Ritesh Tarway > > > >>> Bangalore, India > > > >>> +91-9945365635 > > > >>> > > > >>> <Matrix:Revolution> > > > >>> Seraph: Did you always know? > > > >>> The Oracle: Oh, no. No, I didn't. But I believed... I believed. > > > >>> > > > >>> -- > > > >>> Ritesh Tarway > > > >>> Bangalore, India > > > >>> +91-9945365635 > > > >>> > > > >>> <Matrix:Revolution> > > > >>> Seraph: Did you always know? > > > >>> The Oracle: Oh, no. No, I didn't. But I believed... I believed. > > > >>> > > > >> -- > > > >> Thilina Gunarathne - http://thilinag.blogspot.com > > > >> > > > >> > > --------------------------------------------------------------------- > > > >> To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > >> > > > >> > > > >> > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > -- > > > > Ritesh Tarway > > Bangalore, India > > +91-9945365635 > > > > <Matrix:Revolution> > > Seraph: Did you always know? > > The Oracle: Oh, no. No, I didn't. But I believed... I believed. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
