Reputation: 55
I'm trying to validate an incoming request-order (xml format) against an XSD using a Camel route configuration. However I keep getting the error below. Can anyone help, my code is below.
@Override
public void configure() {
//Other code
onException(ValidationException.class)
.to("{{jms.queue.invalidRequestQueue}}");
from("{{jms.queue.fulfilmentRequest}}")
.routeId(ROUTE_ID)
.to("validation:src/main/resources/xml/OrderCanonical.xsd", "{{jms.queue.fulfilmentRequest}}")
.transacted(PROPAGATION_REQUIRED)
.setHeader(ORDER_ID, xpath(XPATH_FOR_ORDERLINE).namespaces(nm).stringResult())
.beanRef("indiciaService", "getIndicias")
.choice()
.when(header(BOLPMessageHeaders.STATUS).isEqualTo(BOLPFulfilmentStatuses.FAILED))
.log(LoggingLevel.DEBUG, "Indicia call failed. Skipping call to Adobe.")
.to("{{jms.queue.fulfilmentResponse}}")
.otherwise()
.beanRef("adobePostageService", "generatePdf")
.setHeader(BOLPMessageHeaders.STATUS, simple(BOLPFulfilmentStatuses.FULFILLED))
.convertBodyTo(String.class)
.log(LoggingLevel.DEBUG, PRINT_HEADERS)
.log(LoggingLevel.DEBUG, PRINT_BODY)
.to("{{jms.queue.fulfilmentResponse}}");
}
This is the error:
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route BOLPFulfilmentRoute at: >>> To[validator:src/main/resources/xml/OrderCanonical.xsd] <<< in route: Route(BOLPFulfilmentRoute)[[From[{{jms.queue.fulfilmentReque... because of Failed to resolve endpoint: validator://src/main/resources/xml/OrderCanonical.xsd due to: Cannot find resource: src/main/resources/xml/OrderCanonical.xsd in classpath for URI: src/main/resources/xml/OrderCanonical.xsd
Upvotes: 1
Views: 3040
Reputation: 7646
I guess it should be validator
instead of validation
, right?
According to the error message, the XSD file is not found. Please try following file path:
from("{{jms.queue.fulfilmentRequest}}")
.routeId(ROUTE_ID)
.to("validator:xml/OrderCanonical.xsd")
Upvotes: 4