Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-104

Allow alternative schema location in XsdBasedSoap11Wsdl4jDefinitionBuilder

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0 M3
    • Fix Version/s: 1.0.1
    • Component/s: Core
    • Labels:
      None

      Description

      I am using XsdBasedSoap11Wsdl4jDefinitionBuilder to generate WSDL for my schema.
      The schema itself imports another schema via a relative path:

      <xsd:import namespace="https://hyperjaxb2.dev.java.net/pows/po/schema" schemaLocation="../../po/schema/po.xsd"/>

      The WSDL itself is generated quite fine. However the schema itself is simply inserted into wsdl:types while schemaLocation in xsd:import remains the same. However, this location, when resolved against the wsdl location, points to an invalid URL.

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions ...>
      <wsdl:types>
      <xsd:schema ...>
      ...
      <xsd:import namespace="https://hyperjaxb2.dev.java.net/pows/po/schema" schemaLocation="../../po/schema/po.xsd"/>
      ...
      </xsd:schema>
      </wsdl:types>
      ...
      </wsdl:definitions>

      This problem can be easily resolved if instead of inserting the whole schema in wsdl:types we simply insert an xsd:schema with xsd:import pointing to the location of the actual schema. This location can be configured in the wsdl builder:

      <wsdl:definitions ...>
      <wsdl:types>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import
      namespace="https://hyperjaxb2.dev.java.net/pows/ws/schema"
      schemaLocation="resources/ws/schema/ws.xsd"/>
      </xsd:schema>
      </wsdl:types>
      </wsdl:definitions>

      I have implemented this solution based on the XsdBasedSoap11Wsdl4jDefinitionBuilder. Could you please review the code and maybe add this to the main code base.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                arjen.poutsma Arjen Poutsma
                Reporter:
                lexicore Aleksei Valikov
              • Votes:
                6 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: