WebService SchemaValidation Demo for JBoss Native Web Service Stack version 3.0.2
Author: Ana Holzbach (aholzbach at partners.org)
1. This demo was tested with JBoss 4.2.2.GA and JBossWS 3.0.2
2. An eclipse project that implements the steps here detailed is available upon request via email to the author (there doesn't seem to be a way to upload a non-image file to the wiki).
3. See also:
- Documentation on SchemaValidation on the JBossWS wiki:
- A related forum posting:
1. Write a schema
2. Generate JAXB objects from schema using maven-jaxb-plugin (see pom.xml in attached eclipse project)
3. Develop service, annotate with @WebService and @WebMethod
4. Deploy service to jboss without specifying wsdl location (jboss will generate wsdl)
5. Copy wsdl generated by jboss available at a location similar to http://localhost:8080/schema-validation-schema/DataImportService?wsdl to a file.
6. Modify schema included in wsdl as indicated in META-INF\wsdl\import-specimens.wsdl file
7. Add schema location to WebService annotation (wsdlLocation = "META-INF/import-specimens.wsdl")
8. Deploy service to jboss with modified wsdl, verifying at location in 5. above that modifications are there.
9. Add @SchemaValidation to service
10. Write a custom error handler that implements org.xml.sax.ErrorHandler
11. Specify error handler in service, e.g @SchemaValidation(errorHandler=org.partners.betr.demo.webservice.error.CustomErrorHandler.class)
If you don't, org.jboss.ws.extensions.validation.StrictlyValidErrorHandler is used by default
A simple way to test:
Download OxygenXML and use Tools -> WSDL SOAP Analyser to open your deployed wsdl. Oxygen generates a default message that you can then send to the Web Service.