Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ahh, I have recently gone through much of the same quest to find out how to publish a web service through spring-ws based on an xsd. I would highly recommend checking out this blog that I found <a href="http://ankeetmaini.wordpress.com/2011/10/24/spring-web-services-2-made-easy/" rel="nofollow" title="Spring WS 2 Made Easy">Spring WS 2 Made Easy</a></p> <p>Of the 20+ that I looked through it was one of the most helpful and has the complete source easily downloadable.</p> <p>You can publish a web service based solely on an xsd (or wsdl). </p> <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd"&gt; &lt;!-- To detect @Endpoint --&gt; &lt;sws:annotation-driven /&gt; &lt;!-- publish wsdl from xsd (use during development)--&gt; &lt;sws:dynamic-wsdl id="processStuff" portTypeName="MyService" locationUri="/myService" requestSuffix="Request" responseSuffix="Response" targetNamespace="http://mycompany.com/dostuff"&gt; &lt;sws:xsd location="/WEB-INF/xsds/myschema.xsd"/&gt; &lt;/sws:dynamic-wsdl&gt; &lt;!-- publish static wsdl (better for production deployments)--&gt; &lt;sws:static-wsdl id="orders" location="/WEB-INF/wsdl/orders.wsdl"/&gt; &lt;/beans&gt; </code></pre> <p>Spring WS will publish a wsdl at the location of the id, for the xsd example this would publish at... http://localhost:8080/[warName]/processStuff.wsdl</p> <p>Items from the xsd matching the request and response suffixes would be interpreted as wsdl operations when published.</p> <p>You would then need to develop a class annotated with @Endpoint that matches the operations and arguments from the xsd.</p> <p>Small example: </p> <pre><code>@Endpoint public class MyWebService { @PayloadRoot(namespace = "http://mycompany.com/dostuff", localPart = "SomeRequest") @ResponsePayload public SomeResponse getSomething(@RequestPayload SomeRequest something) { return new SomeResponse(); } } </code></pre> <p>I would say it's contract first, you just wrote the contract through code, which I have done myself before. I would rather write Java code than an xsd personally.</p> <p>As noted by Sean F, the dynamic wsdl generation should only be done during development as seen in the noted on Spring's page: </p> <blockquote> <p>Caution</p> <p>Even though it can be quite handy to create the WSDL at runtime from your XSDs, there are a couple of drawbacks to this approach. First off, though we try to keep the WSDL generation process consistent between releases, there is still the possibility that it changes (slightly). Second, the generation is a bit slow, though once generated, the WSDL is cached for later reference. It is therefore recommended to only use during the development stages of your project. Then, we recommend to use your browser to download the generated WSDL, store it in the project, and expose it with . This is the only way to be really sure that the WSDL does not change over time.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload