I have an old (seems) ASMX service and need to use it for .NET Core 2.2. First at all, when I try to add it as WCF service I got an error when I try to use:
InvalidOperationException: The top XML element 'data' from namespace '' references distinct types ServiceReference1.WSIssueNewPayrollCardData and ServiceReference1.WSIssueNewPersonalizedPayrollCardData. Use XML attributes to specify another XML name or namespace for the element or types.
System.Xml.Serialization.XmlReflectionImporter.ReconcileAccessor(Accessor accessor, NameTable accessors)
InvalidOperationException: There was an error reflecting 'data'.
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, string ns, bool hasWrapperElement, bool rpc, bool openModel, RecursionLimiter limiter)
ok, go to definition of WSIssueNewPayrollCardData
and add namespace for every public property, which already has the same name:
[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://com.tch.cards.service/types")]
public partial class WSIssueNewPayrollCardData
{
private string shipToFirstField;
private string shipToLastField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0, Namespace = "http://com.tch.cards.service/types/WSIssueNewPayrollCardData")]
public string shipToFirst
{
get
{
return this.shipToFirstField;
}
set
{
this.shipToFirstField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1, Namespace = "http://com.tch.cards.service/types/WSIssueNewPayrollCardData")]
public string shipToLast
{
get
{
return this.shipToLastField;
}
set
{
this.shipToLastField = value;
}
}
/// <remarks/>
}
then start it. But I face to face with another problem:
InvalidOperationException: The Form property may not be 'Unqualified' when an explicit Namespace property is present. System.Xml.Serialization.XmlReflectionImporter.CheckForm(XmlSchemaForm form, bool isQualified)
InvalidOperationException: There was an error reflecting property 'shipToFirst'. System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, bool openModel, string typeName, RecursionLimiter limiter)
InvalidOperationException: There was an error reflecting type 'ServiceReference1.WSIssueNewPayrollCardData'. System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, string ns, ImportContext context, string dataType, XmlAttributes a, bool repeats, bool openModel, RecursionLimiter limiter)
InvalidOperationException: There was an error reflecting 'data'. System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, string ns, bool hasWrapperElement, bool rpc, bool openModel, RecursionLimiter limiter)
what is wrong, how to use it correctly?