Search code examples
javaspringxsdwsdlspring-ws

Is there a way to expose a static XSD in Spring WS 2?


If, for example orders.wsdl imports Orders.xsd, how can it be configured using static-wsdl

<sws:static-wsdl id="orders" location="/WEB-INF/wsdl/orders.wsdl"/>

such that Orders.xsd can be viewed in the browser like http://host/context/Orders.xsd

Dynamic wsdl supports it.

<sws:dynamic-wsdl id="orders"
    portTypeName="Orders"
    locationUri="http://localhost:8080/ordersService/">
  <sws:xsd location="/WEB-INF/xsd/Orders.xsd"/>
</sws:dynamic-wsdl>

But static-wsdl doesn't have the sws:xsd property.


Solution

  • There is no namspace support but you can do this -

    <bean id="Orders" class="org.springframework.xml.xsd.SimpleXsdSchema">
        <property name="xsd" value="classpath:/Orders.xsd" />
    </bean>
    

    This will resolve the referenced xsd in your wsdl file -

    <wsdl:types>
        <xsd:schema elementFormDefault="qualified">
            <xsd:import namespace="..." schemaLocation="Orders.xsd"></xsd:import>
        </xsd:schema>
    </wsdl:types>