Announcement Announcement Module
No announcement yet.
Now in SVN: dynamically create WSDL based on XSD Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Now in SVN: dynamically create WSDL based on XSD


    I've just committed some code in SVN that creates a WSDL based on a XSD. Basically, it takes the approach I've written about here, but it doesn't use XSLT (it's rather hard to find a XSLT 2.0 implementation). Basically, the idea is to iterate over all elements that end with a certain suffix (’Request’ by default), and to create operations based on that. So if you have a GetHolidayRequest element in the schema, a GetHolidayRequestMessage is created, used by a GetHoliday operation. If a corresponding GetHolidayResponse element is found, it is also put in the operation.

    The echo sample already uses this code:

    <bean id="echo" class="">
      <property name="builder">
        <bean class="">
          <property name="schema" value="/WEB-INF/echo.xsd"/>
          <property name="portTypeName" value="Echo"/>
          <property name="locationUri" value="http://localhost:8080/echo/services"/>
    This means that if you run the echo sample, and request http://localhost:8080/echo/echo.wsdl, you will get the generated wsdl.

  • #2
    Hi Arjen,

    I saw your blog post with the xslt a while ago and really like the idea. I use it with an xsltview to dynamically create the wsdl. I made some modifications:
    * My schema is included with xsd:include rather than copied into the wsdl. The schema is available at same relative path as the generated wsdl.
    * I use a fault suffix naming convention to allow me to define custom faults for each request (eg, GetHolidayFault).

    I've found the second one to be quite useful. Any chance something like this could be added to your wsdl builder?



    • #3
      I like the second one as well. The first feature would be a bit more difficult to implement, because the XSD is a, and can be located on the classpath as well, not just in the war.

      Could you please create an feature issue for the fault suffix option in JIRA. Thanks.


      • #4
        Sure can -

        My xsd is a classpath resource - I load the xsd from classpath and do an identity transform with xsltview to get it in the same spot as the dynamic wsdl. No doubt there's a better way, but not sure it is worth the trouble.


        • #5
          How does this work with JAXB2

          I see the convention works for generating the wsdl from the xsd.

          How do you go about piecing this together when using JAXB2. I can accept my xxxRequest and return my xxxResponse but not my xxxFault?