Implemented #SWS-67: Dynamically create WSDL based on schema. Using it in the echo sample.
This commit is contained in:
0
samples/echo/src/main/webapp/echo.xsd → samples/echo/src/main/webapp/WEB-INF/echo.xsd
Executable file → Normal file
0
samples/echo/src/main/webapp/echo.xsd → samples/echo/src/main/webapp/WEB-INF/echo.xsd
Executable file → Normal file
@@ -28,7 +28,7 @@
|
||||
This interceptor validates both incoming and outgoing message contents according to the 'echo.xsd' XML
|
||||
Schema file.
|
||||
</description>
|
||||
<property name="schema" value="/echo.xsd"/>
|
||||
<property name="schema" value="/WEB-INF/echo.xsd"/>
|
||||
<property name="validateRequest" value="true"/>
|
||||
<property name="validateResponse" value="true"/>
|
||||
</bean>
|
||||
@@ -46,6 +46,25 @@
|
||||
<property name="echoService" ref="echoService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="echo" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
|
||||
<description>
|
||||
This bean definition represents a WSDL definition that is generated at runtime, based on the builder defined
|
||||
below. It can be retrieved by going to /echo/echo.wsdl (i.e. the bean name corresponds to the filename).
|
||||
</description>
|
||||
<property name="builder">
|
||||
<description>
|
||||
The builder creates a WSDL from the 'echo.xsd' schema. It detects all elements that ends with 'Request',
|
||||
finds corresponding 'Response' messages, and creates an operation based on that. All operations are put
|
||||
in a portType with name 'Echo', and binding and service are created.
|
||||
</description>
|
||||
<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
|
||||
<property name="schema" value="/WEB-INF/echo.xsd"/>
|
||||
<property name="portTypeName" value="Echo"/>
|
||||
<property name="locationUri" value="http://localhost:8080/echo/services"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="echoService" class="org.springframework.ws.samples.echo.service.impl.EchoServiceImpl">
|
||||
<description>
|
||||
This bean is our "business" service.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<!-- We map all service request to the springws servlet. -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>spring-ws</servlet-name>
|
||||
<url-pattern>/services</url-pattern>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<mime-mapping>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://www.springframework.org/spring-ws/samples/echo"
|
||||
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.springframework.org/spring-ws/samples/echo">
|
||||
|
||||
<wsdl:types>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:import namespace="http://www.springframework.org/spring-ws/samples/echo/schemas"
|
||||
schemaLocation="echo.xsd"/>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
|
||||
<wsdl:message name="echoRequest">
|
||||
<wsdl:part name="echoString" element="tns:echoRequest"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="echoResponse">
|
||||
<wsdl:part name="theEcho" element="tns:echoResponse"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="TestServicePortType">
|
||||
<wsdl:operation name="echo">
|
||||
<wsdl:input message="tns:echoRequest" name="echoRequest"/>
|
||||
<wsdl:output message="tns:echoResponse" name="echoResponse"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="TestServiceHttpBinding" type="tns:TestServicePortType">
|
||||
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<wsdl:operation name="echo">
|
||||
<wsdlsoap:operation soapAction=""/>
|
||||
<wsdl:input name="echoRequest">
|
||||
<wsdlsoap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output name="echoResponse">
|
||||
<wsdlsoap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
|
||||
<wsdl:service name="TestService">
|
||||
<wsdl:port binding="tns:TestServiceHttpBinding" name="TestServiceHttpPort">
|
||||
<wsdlsoap:address location="http://localhost:8080/echo/services"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
|
||||
Reference in New Issue
Block a user