Make schema for WS-Policy (and related schemas) available to Spring's 
validating parser to preclude fetch them
--------------------------------------------------------------------------------------------------------------

                 Key: CXF-662
                 URL: https://issues.apache.org/jira/browse/CXF-662
             Project: CXF
          Issue Type: Improvement
          Components: WS-* Components
    Affects Versions: 2.1
         Environment: NA
            Reporter: Steven E. Harris


Even though the WS-Policy schema are present in cxf-rt-ws-policy module under 
the "schema" directory, it seems that Spring's XML parser doesn't find the 
schema for

  http://www.w3.org/2006/07/ws-policy

When I mention this schema in my cxf.xml file like the following except, I see 
the error that follows:

   <!-- TODO: Watch for migration of wsam referring to 
http://www.w3.org/ns/ws-policy. -->
   <wsp:Policy wsu:Id="addressingPolicy"
               
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
               xmlns:wsp="http://www.w3.org/2006/07/ws-policy";>
      <wsam:Addressing 
xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata";
                       wsp:Optional="true">
         <wsp:Policy/>
      </wsam:Addressing>
   </wsp:Policy>


Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching 
wildcard is strict, but no declaration can be found for element 'wsp:Policy'.
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
        at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
        at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
        at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1898)
        at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
        at 
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2740)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
        at 
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
        at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at 
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
        at 
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
        at 
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
        at 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351)
        ... 26 more


If I include an explicit schemaLocation declaration for this namespace like the 
following, no error arises:

   <!-- TODO: Watch for migration of wsam referring to 
http://www.w3.org/ns/ws-policy. -->
   <wsp:Policy wsu:Id="addressingPolicy"
               
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
               xmlns:wsp="http://www.w3.org/2006/07/ws-policy";>
               xsi:schemaLocation="http://www.w3.org/2006/07/ws-policy 
http://www.w3.org/2006/11/ws-policy.xsd";>
      <wsam:Addressing 
xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata";
                       wsp:Optional="true">
         <wsp:Policy/>
      </wsam:Addressing>
   </wsp:Policy>


However, in this latter case, the XML parser fetches the schema from the 
supplied URL ovre the network -- or at least it seems to, as it takes a lot 
longer to process the wsp:Policy element.

Should I really need this schemaLocation attribute? If the schema is shipped 
with the cxf-rt-ws-policy module, shouldn't it be found by the XML parser?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to