title: How to use a dynamic endpoint while using the validator component of apache camel?
body: <p>I want to do an xml validation rest service using apache camel, however I want the path to the file to be dynamic but I was not able to do that:</p>
  <pre><code>package com.example.XMLValidator;
  
  import org.apache.camel.builder.RouteBuilder;
  import org.springframework.stereotype.Component;
  
  
  import core.ErrorProcessor;
  
  @Component
  public class XMLValidatorRestService extends RouteBuilder{
      
          @Override
          public void configure() throws Exception {
              
              onException(Exception.class).handled(true)
              .process(new ErrorProcessor());
              
              
  
              rest(&quot;/xmlValidator/{xsdLocation}&quot;)
              .post()
              
              .to(&quot;direct:xmlValidator&quot;);
              
   
              from(&quot;direct:xmlValidator&quot;)
              .choice()
                  .when(header(&quot;ebmName&quot;).isEqualTo(&quot;pers.marriage.ebm.marrInfo_1.0&quot;)).to(&quot;validator:${header.xsdLocation}&quot;)
        .log(&quot;${body}&quot;);
          }   
  }
  </code></pre>
  <p>However this code is giving me the following error:</p>
  <pre><code>Cannot find resource: ${header.ebmName} for URI: ${header.ebmName}
  </code></pre>
  <p>This is the correct route: <code>.to(&quot;validator:file:C:/ISF/trunk/ISFApplications/ServiceBusApplications/Applications/MarriageServiceBusApplication/MarriageSBProject/apps/pers.marriage/ebm/pers.marriage.ebm.marrInfo_1.0.xsd&quot;)</code>
  So any idea how to make this path dynamic? Thank you</p>