[SWS-339] XML namespace (http://www.w3.org/XML/1998/namespace) mapped to wrong prefix when building WSDL with inlined schemas Created: 23/Apr/08  Updated: 03/May/08  Resolved: 03/May/08

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 1.5
Fix Version/s: 1.5.1

Type: Bug Priority: Major
Reporter: Stephen Duncan Jr Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When using CommonsXsdSchemaCollection with inline=true, and inlining a schema that use the xml namespace, the WSDL cannot be generated due to the following exception:

org.xml.sax.SAXParseException: The prefix "xml" cannot be bound to any namespace other than its usual namespace; neither can the namespace for "xml" be bound to any prefix other than "xml".

InliningXsdSchemaTypesProvider.addTypes should check for the namespace "http://www.w3.org/XML/1998/namespace" and always map it to the prefix "xml"



 Comments   
Comment by Arjen Poutsma [ 03/May/08 ]

The xml prefix is always implicitly mapped to http://www.w3.org/XML/1998/namespace, there is no need to map it explicitly in your schema. You can do something like this:

<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>

<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute ref="xml:lang" use="required"/>
</xsd:complexType>
</xsd:element>

which will result in the following WSDL:

<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/spring-ws/include/schema"
xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>

<xsd:element name="GetOrderRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="child" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute ref="xml:lang" use="required"/>
</xsd:complexType>
</xsd:element>

</xsd:schema>
</wsdl:types>

Comment by Stephen Duncan Jr [ 03/May/08 ]

My problem, however, is that I use 3rd-party schemas that include a schema location when they import the xml namespace. Then, when inlining all the schemas, the schema for the xml namespace is included in the WSDL, but with a different prefix. I think modfying InliningXsdSchemaTypesProvider.addTypes to special-case the handling a schema with a target namespace of http://www.w3.org/XML/1998/namespace would be appropriate, as this is a problem with real-world standard schemas out there.

Comment by Arjen Poutsma [ 03/May/08 ]

I see. This is actually an issue in CommonsXsdSchemaCollection, which should not follow the schemaLocation for the XML namespace.

Will fix.

Comment by Arjen Poutsma [ 03/May/08 ]

Fixed. Imports of the XML namespace (http://www.w3.org/XML/1998/namespace) are no longer followed.

Generated at Mon Dec 11 00:26:47 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.