Symptoms
Publishing extracted artifacts fails in two independent ways:
1. Cross-service resource references rejected (HTTP 400)
Extracted artifact JSON carries the source service's ARM id (and diagnostics carry properties.loggerId as a full source ARM path). The publisher sends these verbatim, so publishing to any service other than the one extracted from fails on every resource:
ERROR PUT group/administrators: HTTP 400: ValidationError: Resource id
'/subscriptions/{src-sub}/.../service/{src-svc}/groups/administrators' references
APIM service '{src-svc}', which is different from the service '{target-svc}'
targeted by the request. Cross-service resource references are not allowed.
Reproduced on a live Developer-tier instance: 27/27 PUTs failed (named values, groups, gateways, loggers, products, APIs, diagnostics).
2. SOAP API re-import fails: "Unable to parse WSDL" (HTTP 400) or Timeout (HTTP 422)
APIM's WSDL export is not round-trippable for WCF-originated APIs. The export contains both:
- all XSD schemas inline in
wsdl:types (correct), and
- the original
<xs:import schemaLocation="http://{private-host}/Service.svc?xsd=xsdN"> URLs preserved from the initial import (in our case 32 imports pointing at a private 192.168.x.x address unreachable from Azure).
On re-import (PUT ?import=true&format=wsdl) APIM attempts to resolve every schemaLocation even though each imported namespace is already declared by an inline schema. Result:
ERROR PUT api/{name}: HTTP 400: ValidationError: Parsing error(s): Unable to parse WSDL
(the import parse log shows all-Informational events — "WSDL is considered valid", "Loaded '14' schemas" — then aborts on the unresolvable imports), or on slower SKUs:
ERROR PUT api/{name}: HTTP 422: Timeout: Call to Management API ... timed out
Fix
- Strip the top-level
id from PUT/PATCH bodies (stripSourceArmId in apim-client).
- Rebuild
properties.loggerId of Diagnostic/ApiDiagnostic against the target service (honoring env-mapping affixes), same as the existing ApiRelease apiId / apiVersionSetId normalizations.
- New WSDL normalization
normalizeWsdlXsdImportLocations: drop the schemaLocation attribute from xs:import elements only when the imported namespace is declared by an inline schema (per XML Schema spec, schemaLocation is only a hint; the document is self-contained). Applied on the publish path (fixes already-extracted artifacts) and the extract path (future extracts are clean). wsdl:import location=, no-namespace imports, and imports of namespaces not present inline are left untouched.
Verified end-to-end against a live instance: previously-failing SOAP API now imports with 0 errors (37 creates/updates).
Symptoms
Publishing extracted artifacts fails in two independent ways:
1. Cross-service resource references rejected (HTTP 400)
Extracted artifact JSON carries the source service's ARM
id(and diagnostics carryproperties.loggerIdas a full source ARM path). The publisher sends these verbatim, so publishing to any service other than the one extracted from fails on every resource:Reproduced on a live Developer-tier instance: 27/27 PUTs failed (named values, groups, gateways, loggers, products, APIs, diagnostics).
2. SOAP API re-import fails: "Unable to parse WSDL" (HTTP 400) or Timeout (HTTP 422)
APIM's WSDL export is not round-trippable for WCF-originated APIs. The export contains both:
wsdl:types(correct), and<xs:import schemaLocation="http://{private-host}/Service.svc?xsd=xsdN">URLs preserved from the initial import (in our case 32 imports pointing at a private192.168.x.xaddress unreachable from Azure).On re-import (
PUT ?import=true&format=wsdl) APIM attempts to resolve everyschemaLocationeven though each imported namespace is already declared by an inline schema. Result:(the import parse log shows all-Informational events — "WSDL is considered valid", "Loaded '14' schemas" — then aborts on the unresolvable imports), or on slower SKUs:
Fix
idfrom PUT/PATCH bodies (stripSourceArmIdin apim-client).properties.loggerIdof Diagnostic/ApiDiagnostic against the target service (honoring env-mapping affixes), same as the existing ApiReleaseapiId/apiVersionSetIdnormalizations.normalizeWsdlXsdImportLocations: drop theschemaLocationattribute fromxs:importelements only when the imported namespace is declared by an inline schema (per XML Schema spec,schemaLocationis only a hint; the document is self-contained). Applied on the publish path (fixes already-extracted artifacts) and the extract path (future extracts are clean).wsdl:import location=, no-namespace imports, and imports of namespaces not present inline are left untouched.Verified end-to-end against a live instance: previously-failing SOAP API now imports with 0 errors (37 creates/updates).