When trying to create an instance of a service, I'm getting a
"Method cannot be reflected"
exception. Digging deeper down in the inner exceptions reveals:
"Types 'WebServiceClient.com.compamy.string1' and 'WebServiceClient.com.company.string' both use the XML type name, 'string', from namespace 'http://www.w3.org/2001/XMLSchema'. Use XML attributes to specify a unique XML name and/or namespace for the type."
What does the damn thing want from me? It is code auto generated by VS2010...why do I have to fiddle with it?
Here are the two types:
[GeneratedCode( "System.Xml", "4.0.30319.233" )]
[Serializable]
[DebuggerStepThrough]
[DesignerCategory("code")]
[XmlType(TypeName = "string", Namespace = "http://www.w3.org/2001/XMLSchema")]
[XmlRoot("FileName", Namespace = "http://company.com/api3/Content/Download/", IsNullable = true)]
public partial class string1 : SoapHeader
and
[GeneratedCode("System.Xml", "4.0.30319.233" )]
[Serializable]
[DebuggerStepThrougt]
[DesignerCategory("code")]
[XmlTypeAttribute(Namespace = "http://www.w3.org/2001/XMLSchema")]
[XmlRootAttribute("SessionKey", Namespace = "ns", IsNullable = true)]
public partial class @string : SoapHeader
I found a solution but I cannot explain why it is working. I simply removed all the type mapping attributes from all methods and I don't get any more errors.
Lines removed:
[XmlType(TypeName = "string", Namespace = "http://www.w3.org/2001/XMLSchema")]
If somebody can explain I would really appreciate it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With