Trying to turn on Schema Validation for a webservice I have created. All is ok running without validation, wsconsume has no issues generating artifacts on the server side, nor any issues running wsconsume on client side, nor any issue running the client and getting a response from the server when schema validation is NOT enabled. But, as soon as I turn on schema validation, I get the following error on the server.

17:03:59,347 INFO [SOAPBodyElementDoc] Validating: XML_VALID17:03:59,363 WARN [StrictlyValidErrorHandler] org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'OneCardTxnRequest.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.17:03:59,363 WARN [StrictlyValidErrorHandler] org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'OneCardTxnResponse.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.17:03:59,363 ERROR [StrictlyValidErrorHandler] org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'ocreq:OCReq' to a(n) 'element declaration' component.17:03:59,363 ERROR [SOAPFaultHelperJAXWS] SOAP request exceptionorg.jboss.ws.WSException: org.xml.sax.SAXException: src-resolve: Cannot resolve the name 'ocreq:OCReq' to a(n) 'element declaration' component. at org.jboss.ws.WSException.rethrow(WSException.java:68) at org.jboss.ws.core.soap.SOAPBodyElementDoc.validatePayload(SOAPBodyElementDoc.java:130) at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElementDoc.java:82) at org.jboss.ws.core.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:173) at org.jboss.ws.core.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:263)........

My wsdl does import two xml schemas that represent the request and response documents. Actually, had this as a single schema, but thought I'd break it up too see if the issue was dealing with both elements. Anways, a snippet of the wsdl is as follows.

I do actually generate my artifacts using wsconsume in a different project and then copy my wsdl and the two xml schemas to my WAR's WEB-INF/wsdl directory. Not sure, if that could be effecting anything. Kind of running around in circles at this point. Any ideas would be greatly, greatly appreciated. Thanks, Bob

Back from vacation, about to start looking at this again. The xsd does seem to be available at least if I comment out @SchemaValidation everything works fine. I'll work getting a real simple application going, maybe slim down the schema a-bit. Thanks, Bob

Decided to do some debugging. Looks like SOAPBodyElementDoc.validatePayload calls a method (e.g. SchemaExtractor.getSchemaUrl) which extracts the wsdl:types from the WSDL document resulting in a temporary file located at ${JBOSS_ROOT}\server\default\tmp\jbossws. This temporary schema is used for validation. The problem being my import is in the wsdl:types with a SchemaLocation of "WSTest.xsd". WSTest.xsd is no longer in the same directory; thus is not found by parser. If I manual move my WSTest.xsd to the "tmp" directory the transaction goes thru (e.g. schema validation fails; there is a bad pattern facet in my schema).

So I guess my question is, am I defining the SchemaLocation correctly (e.g. SchemaLocation="WSTest.xsd") or does getSchemaUrl need to identify imports and either redefine the location or copy the schema to the "tmp" directory along with extracted wsdl:types schema?