From 3d8bb53ea31e190608de5a00d8b738bd5747c59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Sun, 6 Apr 2025 12:02:23 +0200 Subject: [PATCH] Document how to use CommonsXsdSchemaCollection with Java config Closes gh-1050 --- spring-ws-docs/src/docs/asciidoc/server.adoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spring-ws-docs/src/docs/asciidoc/server.adoc b/spring-ws-docs/src/docs/asciidoc/server.adoc index 49b2de51..ef21feba 100644 --- a/spring-ws-docs/src/docs/asciidoc/server.adoc +++ b/spring-ws-docs/src/docs/asciidoc/server.adoc @@ -240,6 +240,22 @@ For instance, if our `Orders.xsd` schema defines the `GetOrdersRequest` and `Get To use multiple schemas, either by includes or imports, you can put Commons XMLSchema on the class path. If Commons XMLSchema is on the class path, the `` element follows all XSD imports and includes and inlines them in the WSDL as a single XSD. +With Java config, you can use `CommonsXsdSchemaCollection` as shown in the following example: + +[source,java] +---- +@Bean +public DefaultWsdl11Definition ordersWsdlDefinition() throws Exception { + DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); + // ... configuration + CommonsXsdSchemaCollection schemas = new CommonsXsdSchemaCollection( + new ClassPathResource("xsd/order/main.xsd")); + schemas.setInline(true); + wsdl11Definition.setSchemaCollection(schemas); + return wsdl11Definition; +} +---- + This greatly simplifies the deployment of the schemas, while still making it possible to edit them separately. [WARNING]