Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expose and access static XSD schema in Spring WS 2

Tags:

xsd

spring-ws

I can't reach XSD schema. Here is my configuration:

web.xml

<servlet>
    <servlet-name>spring-ws</servlet-name>
    <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
    <init-param>
        <param-name>transformWsdlLocations</param-name>
        <param-value>true</param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>spring-ws</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

spring-ws-servlet.xml

<sws:annotation-driven/>
<context:component-scan base-package="example.ws.endpoint"/>

<sws:dynamic-wsdl id="boo"
                  portTypeName="BooResource"
                  locationUri="/services/">
    <sws:xsd location="classpath:example/ws/schema/Boo.xsd"/>
</sws:dynamic-wsdl>

WSDL is accessible on [http://localhost:port/spring-ws-server-0.1-SNAPSHOT/services/boo.wsdl], but how can I expose XSD and what will be the URL?

like image 345
sasynkamil Avatar asked Jan 27 '26 19:01

sasynkamil


2 Answers

I've been able to expose my XSD's without using Spring-MVC for it by defining something like this in my @Configuration class:

private ClassPathResource messagesXsdResource = new ClassPathResource("messages.xsd");

@Bean
public SimpleXsdSchema messages() {
    return new SimpleXsdSchema(messagesXsdResource);
}

You should take a look at this question as well, that explains how to do this in XML.

like image 178
evandongen Avatar answered Jan 31 '26 07:01

evandongen


I'm afraid this is not possible, at least not automatically like your WSDLs are exposed. Spring WS doesn't intend to make your XSDs available like it does with the static and generated WSDLs. Of course, you can make your XSDs available through a simple servlet or through MVC (if you're using MVC as well).

like image 24
rowing-ghoul Avatar answered Jan 31 '26 07:01

rowing-ghoul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!