cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Campana <flavio.camp...@maggioli.it>
Subject Error while using WSS4JStaxInInterceptor with CXF-3.0.0
Date Fri, 20 Jun 2014 12:26:15 GMT
I'm getting an error when using WSS4JStaxInInterceptor with CXF-3.0.0, 
an error i didn't get when using 3.0.0-milestone2 (it's in wss4j-2.0.0 
final, milestone 2 was still using rc1).
When WSSec is initialized, WSSUtils.loadWSSecuritySchemas is called with 
various xsds; when it reaches 
"schemas/oasis-200401-wss-wssecurity-secext-1.0.xsd" it throws this 
exception:
org.xml.sax.SAXParseException; lineNumber: 35; columnNumber: 61; 
src-resolve: impossibile risolvere il nome "soap11:mustUnderstand" in un 
componente attribute declaration.
     at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
     at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
     at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4162)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4145)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1678)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAttributeTraverser.traverseLocal(XSDAttributeTraverser.java:90)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTraverser.traverseAttrsAndAttrGrps(XSDAbstractTraverser.java:615)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(XSDComplexTypeTraverser.java:1122)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:335)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseGlobal(XSDComplexTypeTraverser.java:191)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseGlobalDecl(XSDHandler.java:1888)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1776)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:405)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseGlobal(XSDElementTraverser.java:242)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1433)
     at 
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:630)
     at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:616)
     at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:574)
     at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:540)
     at 
com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:252)
     at 
org.apache.wss4j.stax.ext.WSSUtils.loadWSSecuritySchemas(WSSUtils.java:699)
     at org.apache.wss4j.stax.WSSec.<clinit>(WSSec.java:75)
...

soap11 is imported in "schemas/oasis-wss-wssecurity-secext-1.1.xsd"

In wss4j-2.0.0 a call to this method was added:
public static Schema loadWSSecuritySchemas() throws SAXException {
         SchemaFactory schemaFactory = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
         schemaFactory.setResourceResolver(new LSResourceResolver() {
             @Override
             public LSInput resolveResource(String type, String 
namespaceURI, String publicId, String systemId, String baseURI) {
                 if 
("http://www.w3.org/2001/XMLSchema.dtd".equals(systemId)) {
                     ConcreteLSInput concreteLSInput = new 
ConcreteLSInput();
concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream("schemas/XMLSchema.dtd",

WSSec.class));
                     return concreteLSInput;
                 } else if ("XMLSchema.dtd".equals(systemId)) {
                     ConcreteLSInput concreteLSInput = new 
ConcreteLSInput();
concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream("schemas/XMLSchema.dtd",

WSSec.class));
                     return concreteLSInput;
                 } else if ("datatypes.dtd".equals(systemId)) {
                     ConcreteLSInput concreteLSInput = new 
ConcreteLSInput();
concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream("schemas/datatypes.dtd",

WSSec.class));
                     return concreteLSInput;
                 } else if 
("http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd".equals(systemId))

{
                     ConcreteLSInput concreteLSInput = new 
ConcreteLSInput();
concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream("schemas/xmldsig-core-schema.xsd",

WSSec.class));
                     return concreteLSInput;
                 } else if 
("http://www.w3.org/2001/xml.xsd".equals(systemId)) {
                     ConcreteLSInput concreteLSInput = new 
ConcreteLSInput();
concreteLSInput.setByteStream(ClassLoaderUtils.getResourceAsStream("schemas/xml.xsd", 
WSSec.class));
                     return concreteLSInput;
                 }
                 return null;
             }
         });

         Schema schema = schemaFactory.newSchema(
                 new Source[]{
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/exc-c14n.xsd", WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/xmldsig-core-schema.xsd", 
WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/xenc-schema.xsd", 
WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/xenc-schema-11.xsd", 
WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/xmldsig11-schema.xsd", 
WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/oasis-200401-wss-wssecurity-utility-1.0.xsd",

WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/oasis-200401-wss-wssecurity-secext-1.0.xsd",

WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/oasis-wss-wssecurity-secext-1.1.xsd",

WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/ws-secureconversation-200502.xsd",

WSSec.class)),
                         new 
StreamSource(ClassLoaderUtils.getResourceAsStream("schemas/ws-secureconversation-1.3.xsd",

WSSec.class)),
                 }
         );
         return schema;
     }

which wasn't there before.
How can i fix this?
Should i post a bug on wss4j jira?

Mime
View raw message