Skip to content

Commit

Permalink
Fix #232 - support base types from different namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
agpreynolds committed Mar 22, 2019
1 parent c642b30 commit 530aa04
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/SoapCore/MetaWCFBodyWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,21 @@ private void WriteComplexType(XmlDictionaryWriter writer, Type type)
writer.WriteStartElement("xs:complexContent");

writer.WriteStartElement("xs:extension");
writer.WriteAttributeString("base", $"tns:{type.BaseType.Name}");

var modelNamespace = GetModelNamespace(type.BaseType);

var typeName = type.BaseType.Name;

if (_schemaNamespace != modelNamespace)
{
var ns = $"q{_namespaceCounter++}";
writer.WriteAttributeString("base", $"{ns}:{typeName}");
writer.WriteAttributeString($"xmlns:{ns}", modelNamespace);
}
else
{
writer.WriteAttributeString("base", $"tns:{typeName}");
}
}

writer.WriteStartElement("xs:sequence");
Expand Down

0 comments on commit 530aa04

Please sign in to comment.