api-management-schema-import icon indicating copy to clipboard operation
api-management-schema-import copied to clipboard

Enhance WsdlDocument handling on includes and add example WSDL/XSD files

Open abossard opened this issue 11 months ago • 0 comments

Purpose

When trying to process a WSDL with includes, if any include defines a xmlns:xsd attribute, it will fail with a key error, since dotnet XSL parser always adds an xmlns:xs attribute and the ToDictionary will have a key clash.

This PR will make it so that you can have multiple times the same namespace when doing includes. Which is correct, since the included namespace could use an existing namespace on a different property.

Enhancements to Namespace Handling:

  • ApiManagementSchemaImport/Microsoft.Azure.ApiManagement.WsdlProcessor.Common/WsdlDocument.cs: Improved the AddXmlnsAndChangePrefixReferenced method by capturing all declared xmlns attributes and using a composite key for the namespace dictionary to handle potential conflicts.

Addition of New Schema and WSDL Files:

  • examples/includeExample/additional.xsd: Added a new schema file defining an AdditionalElement of type xsd:string.
  • examples/includeExample/common.xsd: Added a new schema file defining a CommonElement of type xsd:string.
  • examples/includeExample/example.wsdl: Added a new WSDL file defining a web service with operations, bindings, and messages.
  • examples/includeExample/schema1.xsd: Added a new schema file with an imported common.xsd and defined a complex type ExampleType with an exampleField.
  • examples/includeExample/schema2.xsd: Added a new schema file with an imported common.xsd, included additional.xsd, and defined a complex type ExampleType with an exampleField.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
  • Test it on the new includeExample
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install

abossard avatar Feb 04 '25 22:02 abossard