Skip to content

Instantly share code, notes, and snippets.

@northlander
Created February 14, 2018 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save northlander/d429f7189c5a63f3d74c6346098d514a to your computer and use it in GitHub Desktop.
Save northlander/d429f7189c5a63f3d74c6346098d514a to your computer and use it in GitHub Desktop.
Circular XSD import from WSDL

Circular references to XSD from WSDL

Given the following structure of base xsd:s and imports, it can be hard to use it in some frameworks.

  • base-types.xsd
  • special-types.xsd (imports base-types.xsd)
  • web-service1.xsd (request and response structures, imports base-types.xsd and special-types.xsd)
  • web-service1.wsdl (imports webservice.xsd)

A solution is to avoid schemaLocation in the special-types.xsd file.

So special-types.xsd without schemaLocation:

 <xs:import namespace="http://example.org/base-types/v1"/>

and web-service1.xsd with schemaLocation:

<xs:import namespace="http://example.org/base-types/v1"
            schemaLocation="base-types.xsd"/>
<xs:import namespace="http://example.org/special-types/v1"
            schemaLocation="special-types.xsd"/>

Voíla!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment