Announcement Announcement Module
Collapse
No announcement yet.
WSDL->Java generation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WSDL->Java generation

    Hi all.

    Is Spring-WS supose to provide some kind of WSDL->Java generation in the future? Or I don't see the whole picture about Spring-WS good ?

    I'm interested in it because it's most usual thing that my customers give me WSDL and URL of some SOAP service, and I should do the communication without having to know anything about SOAP protocol since java client stubs are generated and ready for use.

    Regards,
    Vjeran

  • #2
    Originally posted by vmarcinko
    Is Spring-WS supose to provide some kind of WSDL->Java generation in the future?
    The short answer: no. For the longer answer, see below.

    Originally posted by vmarcinko
    I'm interested in it because it's most usual thing that my customers give me WSDL and URL of some SOAP service, and I should do the communication without having to know anything about SOAP protocol since java client stubs are generated and ready for use.
    Spring-WS has no client-side functionality right now, and probably will not for the 1.0. However, the creation of Java stubs can also be used on the server side, to quickly create a "service" that adheres to a WSDL. Let me tell you why I think that this is a bad idea.

    Spring-WS is about writing document-driven web services. Central in the design is the incoming XML document which is handled by a certain endpoint. You can do this using DOM, SAX, etc. XML handling is at the core, because you really are sending XML across the wire: you cannot hide from it .

    Now, when you create a stub from a XSD schema (contained in a WSDL), you won't see the XML. You only see classes generated from XSD schema's, etc. This isn't a bad thing per se, but I think it should be an option. We provide that option with the Spring-OXM module and the AbstractMarshallingPayloadEndpoint. The airline sample contained in the buildable distribution shows an example of this using JAXB.

    Besides the schema classes, a Service class is usually created. This service class contains all the operations mentioned in the WSDL as methods, and uses the schema classes as parameters and return value. Now, if you would read the SOAP specification, you would notice that there is no mention of the concepts service, portType, or operation anywhere. That is because a WSDL is a way to express RPC-style Web Services much more than it is a way to express document-style Web Services. In some ways, WSDL is like what IDL was for CORBA, only worse. Sadly, it is the standard.

    For more info on this, check my blog, especially this post.

    So what this means is that you have to write your own WSDL for now. This isn't that hard, especially if you separate the the schema (i.e. the format of your messages) from the rest (the service description), like I did in the sample. The service than basically becomes a collection of messages.
    The added value of this procedure is that you can use the schema for other stuff like validation using the PayloadValidatingInterceptor (response validation is very handy during development: it shows you whether the messages you send adhere to your own contract).

    Comment

    Working...
    X