title: SAML Assertion Validation using OpenSAML 3
body: <p>I was trying to validate SAMLResponse assertions using OpenSAML 3.
  Link: <a href="http://shibboleth.net/pipermail/dev/2016-November/008920.html" rel="nofollow noreferrer">http://shibboleth.net/pipermail/dev/2016-November/008920.html</a></p>
  <p>While i was trying to run the below code, i was getting an exception</p>
  <pre><code>java.lang.ClassCastException: org.opensaml.ws.soap.soap11.impl.BodyBuilder cannot be cast to org.opensaml.core.xml.XMLObjectBuilder
  </code></pre>
  <p>This was immediately after executing &quot;InitializationService.initialize()&quot;.</p>
  <pre><code>   @PostConstruct
     public void init() {
  
      try {
        InitializationService.initialize();
        DocumentBuilderFactory documentBuilderFactory = 
        DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        docBuilder = documentBuilderFactory.newDocumentBuilder();
        unmarshallerFactory = 
           XMLObjectProviderRegistrySupport.getUnmarshallerFactory();
        } catch (Exception e){
        logger.error(&quot;Error: &quot;,e);
        }
     }
  </code></pre>
  <h2>Exception Details</h2>
  <pre><code>java.lang.ClassCastException: org.opensaml.ws.soap.soap11.impl.BodyBuilder cannot be cast to org.opensaml.core.xml.XMLObjectBuilder
  at org.opensaml.core.xml.config.XMLConfigurator.initializeObjectProviders(XMLConfigurator.java:238)
      at org.opensaml.core.xml.config.XMLConfigurator.load(XMLConfigurator.java:203)
      at org.opensaml.core.xml.config.XMLConfigurator.load(XMLConfigurator.java:188)
      at org.opensaml.core.xml.config.XMLConfigurator.load(XMLConfigurator.java:162)
      at org.opensaml.core.xml.config.AbstractXMLObjectProviderInitializer.init(AbstractXMLObjectProviderInitializer.java:52)
      at org.opensaml.core.config.InitializationService.initialize(InitializationService.java:56)
  </code></pre>
  <h2>POM</h2>
  <p>Below are the dependencies considered in the POM</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;org.opensaml&lt;/groupId&gt;
      &lt;artifactId&gt;xmltooling&lt;/artifactId&gt;
      &lt;version&gt;1.4.4&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.opensaml&lt;/groupId&gt;
      &lt;artifactId&gt;opensaml-core&lt;/artifactId&gt;
      &lt;version&gt;3.1.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.opensaml&lt;/groupId&gt;
      &lt;artifactId&gt;opensaml-saml-impl&lt;/artifactId&gt;
      &lt;version&gt;3.2.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
     &lt;groupId&gt;org.opensaml&lt;/groupId&gt;
     &lt;artifactId&gt;opensaml-soap-api&lt;/artifactId&gt;
     &lt;version&gt;3.3.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.opensaml&lt;/groupId&gt;
      &lt;artifactId&gt;opensaml-saml-api&lt;/artifactId&gt;
      &lt;version&gt;3.3.0&lt;/version&gt;
  &lt;/dependency&gt;
          
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.santuario&lt;/groupId&gt;
      &lt;artifactId&gt;xmlsec&lt;/artifactId&gt;
      &lt;version&gt;2.0.7&lt;/version&gt;
  &lt;/dependency&gt;
          
   &lt;dependency&gt;
      &lt;groupId&gt;org.apache.ant&lt;/groupId&gt;
      &lt;artifactId&gt;ant&lt;/artifactId&gt;
      &lt;version&gt;1.8.2&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <hr />
  <p>Appreciate any pointers on this. Thanks</p>