Reputation: 4010
Don't know if it is possible, but I'll try to explain the best I can. I have come across some code where an out of the box WSDL and XSD were being modified, primarily to have a custom XSD with the <types>
stripped out and placed in their own XSD (instead of living in <types>
). Small changes were made to some of the classes to change input/output object types for some reason.
In the future if there are any updates to the WSDL, someone will have to go in by hand and remod the XSD to match our needs, plus have the new items from the updated WSDL version.
After hunting around on SO it seems that you can import multiple schemas into a WSDL's <types>
definition. I was wondering the order in which those XSDs load, is it related to their ordering in the <types>
? Is it possible to "override" classes that would be common between both XSDs (the original, and the modded one)?
Basically I want to pull out the modded changes and put them in their own, very lightweight, XSD to reduce the footprint. Once they are in their own XSD, any new WSDL changes (new versions, etc) can get pulled right into a "base" XSD while having the small overriden class list in the "mod" XSD. The classes would have the same namespace and same class name.
What's the correct (is it possible) way to do something like this:
WSDL File
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.com/ExampleNamespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
name="ExampleService"
targetNamespace="http://example.com/ExampleNamespace">
<wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:schema>
<xsd:import schemaLocation="ORIGINAL.XSD"
namespace="http://example.com/ExampleNamespace" />
<xsd:import schemaLocation="OVERRIDE.XSD"
namespace="http://example.com/ExampleNamespace" />
</xsd:schema>
</wsdl:types>
.......
</wsdl:definitions>
ORIGINAL XSD
<xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.com/ExampleNamespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
targetNamespace="http://example.com/ExampleNamespace">
<xsd:complexType name="ComplexTypeA">
<xsd:sequence>
<xsd:element name="exampleElementOne" type="xsd:base64Binary" />
<xsd:element name="exampleElementTwo" type="xsd:base64Binary" />
</xsd:sequence>
</xsd:complexType>
...
<xsd:complexType name="ComplexTypeN">
...
</xsd:complexType>
</xsd:schema>
OVERRIDE XSD
<xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.com/ExampleNamespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
targetNamespace="http://example.com/ExampleNamespace">
<!-- Override only ComplexTypeA -->
<xsd:complexType name="ComplexTypeA">
<xsd:sequence>
<xsd:element name="exampleElementOne" type="xsd:string" />
<xsd:element name="exampleElementTwo" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Upvotes: 1
Views: 489
Reputation: 818
You won't be able to import two Schemas that have the same element with the same namespace. If you have to change a schema, you will have to make changes to the existing schema.
Upvotes: 1