Skip to content

Commit 262ff36

Browse files
committed
SWS-169
1 parent 17fe56e commit 262ff36

File tree

2 files changed

+89
-32
lines changed

2 files changed

+89
-32
lines changed

src/docbkx/server.xml

Lines changed: 88 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,22 @@
6161
<orderedlist>
6262
<listitem>
6363
<para>
64-
An appropriate endpoint is searched for using the configured
65-
<literal>EndpointMapping(s)</literal>. If an endpoint is found,
66-
the invocation chain associated with the endpoint (preprocessors,
67-
postprocessors, and endpoints) will be executed in order to create
68-
a response.
64+
An appropriate endpoint is searched for using the configured <literal>EndpointMapping(s)</literal>.
65+
If an endpoint is found, the invocation chain associated with the endpoint (preprocessors,
66+
postprocessors, and endpoints) will be executed in order to create a response.
6967
</para>
7068
</listitem>
7169
<listitem>
7270
<para>
73-
An appropriate adapter is searched for the endpoint. The
74-
<classname>MessageDispatcher</classname> delegates to this adapter
75-
to invoke the endpoint.
71+
An appropriate adapter is searched for the endpoint. The <classname>MessageDispatcher</classname>
72+
delegates to this adapter to invoke the endpoint.
7673
</para>
7774
</listitem>
7875
<listitem>
7976
<para>
8077
If a response is returned, it is sent on its way. If no response is returned (which could be due to
81-
a pre- or post-processor intercepting the request, for example, for security reasons), no response is
82-
sent.
78+
a pre- or post-processor intercepting the request, for example, for security reasons), no response
79+
is sent.
8380
</para>
8481
</listitem>
8582
</orderedlist>
@@ -149,29 +146,39 @@
149146
</para>
150147
<section>
151148
<title>Automatic WSDL exposure</title>
152-
<para>The <classname>MessageDispatcherServlet</classname> will automatically detect any
153-
<interfacename>WsdlDefinition</interfacename> beans defined in it's Spring container. All such
154-
<interfacename>WsdlDefinition</interfacename> beans that are detected will also be exposed via
155-
a <classname>WsdlDefinitionHandlerAdapter</classname>; this is a very convenient way to expose your WSDL
156-
to clients simply by just defining some beans. </para>
157-
<para>By way of an example, consider the following bean definition, defined in the Spring-WS framework's
158-
configuration file ('<literal>/WEB-INF/[servlet-name]-servlet.xml</literal>'). Take notice of the
159-
value of the bean's '<literal>id</literal>' attribute, because this will be used when exposing
160-
the WSDL.</para>
149+
<para>
150+
The <classname>MessageDispatcherServlet</classname> will automatically detect any
151+
<interfacename>WsdlDefinition</interfacename> beans defined in it's Spring container. All such
152+
<interfacename>WsdlDefinition</interfacename> beans that are detected will also be exposed via
153+
a <classname>WsdlDefinitionHandlerAdapter</classname>; this is a very convenient way to expose your
154+
WSDL to clients simply by just defining some beans.
155+
</para>
156+
<para>
157+
By way of an example, consider the following bean definition, defined in the Spring-WS framework's
158+
configuration file ('<filename>/WEB-INF/[servlet-name]-servlet.xml</filename>'). Take notice of the
159+
value of the bean's '<literal>id</literal>' attribute, because this will be used when exposing
160+
the WSDL.
161+
</para>
161162
<programlisting><![CDATA[<bean id="orders" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
162163
<constructor-arg value="/WEB-INF/wsdl/Orders.wsdl"/>
163164
</bean>]]></programlisting>
164-
<para>The WSDL defined in the '<filename>Orders.wsdl</filename>' file can then be accessed via
165-
<literal>GET</literal> requests to a URL of the following form (substitute the host, port and servlet
166-
context path as appropriate).</para>
165+
<para>
166+
The WSDL defined in the '<filename>Orders.wsdl</filename>' file can then be accessed via
167+
<literal>GET</literal> requests to a URL of the following form (substitute the host, port and
168+
servlet context path as appropriate).
169+
</para>
167170
<programlisting><![CDATA[http://localhost:8080/spring-ws/orders.wsdl]]></programlisting>
168-
<para>Another cool feature of the <classname>MessageDispatcherServlet</classname> (or more
169-
correctly the <classname>WsdlDefinitionHandlerAdapter</classname>) is that it is able to
170-
transform the value of the '<literal>location</literal>' of all the WSDL that it exposes to reflect the
171-
URL of the incoming request.</para>
172-
<para>Please note that this '<literal>location</literal>' transformation feature is
173-
<emphasis>off</emphasis> by default.To switch this feature on, you just need to specify an
174-
initialization parameter to the <classname>MessageDispatcherServlet</classname>, like so:</para>
171+
<para>
172+
Another cool feature of the <classname>MessageDispatcherServlet</classname> (or more correctly the
173+
<classname>WsdlDefinitionHandlerAdapter</classname>) is that it is able to
174+
transform the value of the '<literal>location</literal>' of all the WSDL that it exposes to reflect
175+
the URL of the incoming request.
176+
</para>
177+
<para>
178+
Please note that this '<literal>location</literal>' transformation feature is
179+
<emphasis>off</emphasis> by default.To switch this feature on, you just need to specify an
180+
initialization parameter to the <classname>MessageDispatcherServlet</classname>, like so:
181+
</para>
175182
<programlisting><![CDATA[<web-app>
176183
177184
<servlet>
@@ -189,8 +196,58 @@
189196
</servlet-mapping>
190197
191198
</web-app>]]></programlisting>
192-
<para>Consult the class-level Javadoc on the <classname>WsdlDefinitionHandlerAdapter</classname> class
193-
which explains the whole transformation process in more detail.</para>
199+
<para>
200+
Consult the class-level Javadoc on the <classname>WsdlDefinitionHandlerAdapter</classname> class
201+
which explains the whole transformation process in more detail.
202+
</para>
203+
<section>
204+
<title>Exposing a static WSDL</title>
205+
<para>
206+
As indicated above, a static WSDL file can be exposed by using the
207+
<classname>SimpleWsdl11Definition</classname>. Simply wire it up, and give it a
208+
<interfacename>Resource</interfacename> for the <property>wsdl</property> property, or use the
209+
contructor, as shown in the example above.
210+
</para>
211+
</section>
212+
<section>
213+
<title>Dynamically creating a WSDL from an XSD</title>
214+
<para>
215+
As shown in <xref linkend="tutorial-publishing-wsdl"/>, Spring Web Services can generate a WSDL
216+
file from a XSD schema, using conventions. The next application context snippet shows how to
217+
create such a dynamic WSDL file:
218+
</para>
219+
<programlisting><![CDATA[
220+
<bean id="holiday" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
221+
<property name="builder">
222+
<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
223+
<property name="schema" value="/WEB-INF/xsd/Orders.xsd"/>
224+
<property name="portTypeName" value="Orders"/>
225+
<property name="locationUri" value="http://localhost:8080/ordersService/"/>
226+
</bean>
227+
</property>
228+
</bean>]]></programlisting>
229+
<para>
230+
The <classname>DynamicWsdl11Definition</classname> uses a
231+
<interfacename>Wsdl11DefinitionBuilder</interfacename> implementation
232+
to generate a WSDL the first time it is requested.
233+
Typically, we use a <classname>XsdBasedSoap11Wsdl4jDefinitionBuilder</classname>, which builds
234+
a WSDL from a XSD schema. This builder iterates over all <literal>element</literal> elements
235+
found in the schema, and creates a <literal>message</literal> for elements that end with the
236+
defined request or response suffix. The default request suffix is <literal>Request</literal>;
237+
the default response suffix is <literal>Response</literal>, though these can be changed by
238+
setting the <property>requestSuffix</property> and <property>responseSuffix</property>
239+
properties, respectively.
240+
Next, the builder combines the request and response messages into a WSDL
241+
<literal>operation</literal>s, and builds a <literal>portType</literal> based on the operations.
242+
</para>
243+
<para>
244+
For instance, if our <filename>Orders.xsd</filename> schema defines the
245+
<literal>GetOrdersRequest</literal> and <literal>GetOrdersResponse</literal> elements, the
246+
<classname>XsdBasedSoap11Wsdl4jDefinitionBuilder</classname> will create a
247+
<literal>GetOrdersRequest</literal> and <literal>GetOrdersResponse</literal> message, and a
248+
<literal>GetOrders</literal> operation, which is put in a <literal>Orders</literal> port type.
249+
</para>
250+
</section>
194251
</section>
195252
</section>
196253
<section>

src/docbkx/tutorial.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ public class HolidayEndpoint extends AbstractJDomPayloadEndpoint {
704704
</para>
705705
</section>
706706
</section>
707-
<section>
707+
<section id="tutorial-publishing-wsdl">
708708
<title>Publishing the WSDL</title>
709709
<para>
710710
Finally, we need to publish the WSDL. As stated in <xref linkend="tutorial-service-contract"/>, we don't

0 commit comments

Comments
 (0)