C# Escaping XmlType Name with special char within XmlType() Attribute

57 views Asked by At

i need to implement and SOAP Service without using the WSDL (because its broken and will not be fixed). Now im stuck at a point where i need to set type attributes for some classes (base classes and derived one)

normaly ill decorate my DTOs like this:

BaseClass:

[XmlInclude(typeof(Person))]
[XmlType("Partner", Namespace = "http://....")]
public abstract class Partner 
{...}

and the DerivedOne:

 [XmlType("Person")]
public class Person : Partner
{...}

the result looks like this:
<tar:Partner xsi:type="Person">

but now the API Document tells me to create a request like:

<tar:Partner xsi:type="par:CT_Person">

(tested in Fiddler and works) How is it possible to create a typeName set with a NameSpace Prefix (par) or set the name like:

[XmlType("par:CT_Person")]?

deactivate(override) the escaping functionallity is no option for me.

thanks in advance.

1

There are 1 answers

0
Vampirasu On BEST ANSWER

after testing the whole day and trying around... right after writing my question i got the answer by my self.

when i set the namespace in my baseclass i can set a namespace in my derived one with a different URL. than it works...

hope this post will help someone else facing the problem :)