Duplicate C# web service proxy classes generated for Java types
Posted
by
Sergey
on Stack Overflow
See other posts from Stack Overflow
or by Sergey
Published on 2009-09-24T15:04:25Z
Indexed on
2012/06/29
15:16 UTC
Read the original article
Hit count: 229
My question is about integration between a Java web service and a C# .NET client.
Service: CXF 2.2.3 with Aegis databinding Client: C#, .NET 3.5 SP1
For some reason Visual Studio generates two C# proxy enums for each Java enum. The generated C# classes do not compile.
For example, this Java enum:
public enum SqlDialect {
GENERIC, SYBASE, SQL_SERVER, ORACLE;
}
Produces this WSDL:
<xsd:simpleType name="SqlDialect">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="GENERIC" />
<xsd:enumeration value="SYBASE" />
<xsd:enumeration value="SQL_SERVER" />
<xsd:enumeration value="ORACLE" />
</xsd:restriction>
</xsd:simpleType>
For this WSDL Visual Studio generates two partial C# classes (generated comments removed):
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="SqlDialect", Namespace="http://somenamespace")]
public enum SqlDialect : int {
[System.Runtime.Serialization.EnumMemberAttribute()]
GENERIC = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
SYBASE = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
SQL_SERVER = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
ORACLE = 3,
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://somenamespace")]
public enum SqlDialect {
GENERIC,
SYBASE,
SQL_SERVER,
ORACLE,
}
The resulting C# code does not compile:
The namespace 'somenamespace' already contains a definition for 'SqlDialect'
I will appreciate any ideas...
© Stack Overflow or respective owner