|
61 | 61 | <orderedlist> |
62 | 62 | <listitem> |
63 | 63 | <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. |
69 | 67 | </para> |
70 | 68 | </listitem> |
71 | 69 | <listitem> |
72 | 70 | <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. |
76 | 73 | </para> |
77 | 74 | </listitem> |
78 | 75 | <listitem> |
79 | 76 | <para> |
80 | 77 | 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. |
83 | 80 | </para> |
84 | 81 | </listitem> |
85 | 82 | </orderedlist> |
|
149 | 146 | </para> |
150 | 147 | <section> |
151 | 148 | <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> |
161 | 162 | <programlisting><![CDATA[<bean id="orders" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition"> |
162 | 163 | <constructor-arg value="/WEB-INF/wsdl/Orders.wsdl"/> |
163 | 164 | </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> |
167 | 170 | <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> |
175 | 182 | <programlisting><![CDATA[<web-app> |
176 | 183 |
|
177 | 184 | <servlet> |
|
189 | 196 | </servlet-mapping> |
190 | 197 |
|
191 | 198 | </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> |
194 | 251 | </section> |
195 | 252 | </section> |
196 | 253 | <section> |
|
0 commit comments