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

北城余情 提交于 2020-01-02 12:40:47

问题


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.


回答1:


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>



回答2:


or you can tyt with that

 <wsdl:types>


   <xs:schema targetNamespace="...."
          elementFormDefault="qualified">

                <xs:include schemaLocation="xsd/Order.xsd"/>

   </xs:schema>


来源:https://stackoverflow.com/questions/11642100/is-there-a-way-to-expose-a-static-xsd-in-spring-ws-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!